author | Gregory Szorc <gregory.szorc@gmail.com> |
Mon, 21 Feb 2022 10:40:58 -0700 | |
changeset 48902 | 1ba11c8f3430 |
parent 45551 | 4c8d9b53b1c7 |
permissions | -rw-r--r-- |
28060 | 1 |
TARGET = chg |
30693 | 2 |
SRCS = chg.c hgclient.c procutil.c util.c |
28060 | 3 |
OBJS = $(SRCS:.c=.o) |
4 |
||
5 |
CFLAGS ?= -O2 -Wall -Wextra -pedantic -g |
|
33629
5544af862286
chg: define _GNU_SOURCE to allow CentOS 5 compilation
Mathias De Maré <mathias.de_mare@nokia.com>
parents:
30738
diff
changeset
|
6 |
CPPFLAGS ?= -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE |
28060 | 7 |
override CFLAGS += -std=gnu99 |
28605
baa073200ba2
chg: allows default hg path to be overridden
Jun Wu <quark@fb.com>
parents:
28327
diff
changeset
|
8 |
ifdef HGPATH |
baa073200ba2
chg: allows default hg path to be overridden
Jun Wu <quark@fb.com>
parents:
28327
diff
changeset
|
9 |
override CPPFLAGS += -DHGPATH=\"$(HGPATH)\" |
baa073200ba2
chg: allows default hg path to be overridden
Jun Wu <quark@fb.com>
parents:
28327
diff
changeset
|
10 |
endif |
45551
4c8d9b53b1c7
chg: make is possible to call by default an hg binary located next to chg
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents:
34655
diff
changeset
|
11 |
ifdef HGPATHREL |
4c8d9b53b1c7
chg: make is possible to call by default an hg binary located next to chg
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents:
34655
diff
changeset
|
12 |
override CPPFLAGS += -DHGPATHREL=\"$(HGPATHREL)\" |
4c8d9b53b1c7
chg: make is possible to call by default an hg binary located next to chg
Valentin Gatien-Baron <vgatien-baron@janestreet.com>
parents:
34655
diff
changeset
|
13 |
endif |
28060 | 14 |
|
15 |
DESTDIR = |
|
16 |
PREFIX = /usr/local |
|
17 |
MANDIR = $(PREFIX)/share/man/man1 |
|
18 |
||
19 |
.PHONY: all |
|
20 |
all: $(TARGET) |
|
21 |
||
22 |
$(TARGET): $(OBJS) |
|
23 |
$(CC) $(LDFLAGS) -o $@ $(OBJS) |
|
24 |
||
30693 | 25 |
chg.o: hgclient.h procutil.h util.h |
30738
a45c0f42271f
chg: handle pager request client-side
Jun Wu <quark@fb.com>
parents:
30693
diff
changeset
|
26 |
hgclient.o: hgclient.h procutil.h util.h |
30693 | 27 |
procutil.o: procutil.h util.h |
28060 | 28 |
util.o: util.h |
29 |
||
30 |
.PHONY: install |
|
31 |
install: $(TARGET) |
|
34624
884855ce5e63
build: chg build was failing when the base directory contained spaces
muxator <a.mux@inwind.it>
parents:
33629
diff
changeset
|
32 |
install -d "$(DESTDIR)$(PREFIX)"/bin |
884855ce5e63
build: chg build was failing when the base directory contained spaces
muxator <a.mux@inwind.it>
parents:
33629
diff
changeset
|
33 |
install -m 755 "$(TARGET)" "$(DESTDIR)$(PREFIX)"/bin |
884855ce5e63
build: chg build was failing when the base directory contained spaces
muxator <a.mux@inwind.it>
parents:
33629
diff
changeset
|
34 |
install -d "$(DESTDIR)$(MANDIR)" |
884855ce5e63
build: chg build was failing when the base directory contained spaces
muxator <a.mux@inwind.it>
parents:
33629
diff
changeset
|
35 |
install -m 644 chg.1 "$(DESTDIR)$(MANDIR)" |
28060 | 36 |
|
37 |
.PHONY: clean |
|
38 |
clean: |
|
39 |
$(RM) $(OBJS) |
|
40 |
||
41 |
.PHONY: distclean |
|
42 |
distclean: |
|
43 |
$(RM) $(OBJS) $(TARGET) |