author | Pierre-Yves David <pierre-yves.david@octobus.net> |
Sun, 02 Jul 2017 01:37:03 +0200 | |
changeset 33253 | 8dff2a0d3d12 |
parent 30738 | a45c0f42271f |
child 33629 | 5544af862286 |
permissions | -rw-r--r-- |
28062
1000ccf804a6
chg: use in-tree hg executable to start server for testing
Yuya Nishihara <yuya@tcha.org>
parents:
28060
diff
changeset
|
1 |
HG = $(CURDIR)/../../hg |
28060 | 2 |
|
3 |
TARGET = chg |
|
30693 | 4 |
SRCS = chg.c hgclient.c procutil.c util.c |
28060 | 5 |
OBJS = $(SRCS:.c=.o) |
6 |
||
7 |
CFLAGS ?= -O2 -Wall -Wextra -pedantic -g |
|
8 |
CPPFLAGS ?= -D_FORTIFY_SOURCE=2 |
|
9 |
override CFLAGS += -std=gnu99 |
|
28605
baa073200ba2
chg: allows default hg path to be overridden
Jun Wu <quark@fb.com>
parents:
28327
diff
changeset
|
10 |
ifdef HGPATH |
baa073200ba2
chg: allows default hg path to be overridden
Jun Wu <quark@fb.com>
parents:
28327
diff
changeset
|
11 |
override CPPFLAGS += -DHGPATH=\"$(HGPATH)\" |
baa073200ba2
chg: allows default hg path to be overridden
Jun Wu <quark@fb.com>
parents:
28327
diff
changeset
|
12 |
endif |
28060 | 13 |
|
14 |
DESTDIR = |
|
15 |
PREFIX = /usr/local |
|
16 |
MANDIR = $(PREFIX)/share/man/man1 |
|
17 |
||
18 |
CHGSOCKDIR = /tmp/chg$(shell id -u) |
|
19 |
CHGSOCKNAME = $(CHGSOCKDIR)/server |
|
20 |
||
21 |
.PHONY: all |
|
22 |
all: $(TARGET) |
|
23 |
||
24 |
$(TARGET): $(OBJS) |
|
25 |
$(CC) $(LDFLAGS) -o $@ $(OBJS) |
|
26 |
||
30693 | 27 |
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
|
28 |
hgclient.o: hgclient.h procutil.h util.h |
30693 | 29 |
procutil.o: procutil.h util.h |
28060 | 30 |
util.o: util.h |
31 |
||
32 |
.PHONY: install |
|
33 |
install: $(TARGET) |
|
34 |
install -d $(DESTDIR)$(PREFIX)/bin |
|
35 |
install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin |
|
36 |
install -d $(DESTDIR)$(MANDIR) |
|
37 |
install -m 644 chg.1 $(DESTDIR)$(MANDIR) |
|
38 |
||
39 |
.PHONY: serve |
|
40 |
serve: |
|
41 |
[ -d $(CHGSOCKDIR) ] || ( umask 077; mkdir $(CHGSOCKDIR) ) |
|
42 |
$(HG) serve --cwd / --cmdserver chgunix \ |
|
43 |
--address $(CHGSOCKNAME) \ |
|
44 |
--config cmdserver.log=/dev/stderr |
|
45 |
||
46 |
.PHONY: clean |
|
47 |
clean: |
|
48 |
$(RM) $(OBJS) |
|
49 |
||
50 |
.PHONY: distclean |
|
51 |
distclean: |
|
52 |
$(RM) $(OBJS) $(TARGET) |