author | Siddharth Agarwal <sid0@fb.com> |
Thu, 10 Mar 2016 10:12:23 -0800 | |
changeset 28444 | 12fdf49fa4dd |
parent 28327 | 3ab370f84a23 |
child 28605 | baa073200ba2 |
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 |
|
4 |
SRCS = chg.c hgclient.c util.c |
|
5 |
OBJS = $(SRCS:.c=.o) |
|
6 |
||
7 |
CFLAGS ?= -O2 -Wall -Wextra -pedantic -g |
|
8 |
CPPFLAGS ?= -D_FORTIFY_SOURCE=2 |
|
9 |
override CFLAGS += -std=gnu99 |
|
10 |
||
11 |
DESTDIR = |
|
12 |
PREFIX = /usr/local |
|
13 |
MANDIR = $(PREFIX)/share/man/man1 |
|
14 |
||
15 |
CHGSOCKDIR = /tmp/chg$(shell id -u) |
|
16 |
CHGSOCKNAME = $(CHGSOCKDIR)/server |
|
17 |
||
18 |
.PHONY: all |
|
19 |
all: $(TARGET) |
|
20 |
||
21 |
$(TARGET): $(OBJS) |
|
22 |
$(CC) $(LDFLAGS) -o $@ $(OBJS) |
|
23 |
||
24 |
chg.o: hgclient.h util.h |
|
25 |
hgclient.o: hgclient.h util.h |
|
26 |
util.o: util.h |
|
27 |
||
28 |
.PHONY: install |
|
29 |
install: $(TARGET) |
|
30 |
install -d $(DESTDIR)$(PREFIX)/bin |
|
31 |
install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin |
|
32 |
install -d $(DESTDIR)$(MANDIR) |
|
33 |
install -m 644 chg.1 $(DESTDIR)$(MANDIR) |
|
34 |
||
35 |
.PHONY: serve |
|
36 |
serve: |
|
37 |
[ -d $(CHGSOCKDIR) ] || ( umask 077; mkdir $(CHGSOCKDIR) ) |
|
38 |
$(HG) serve --cwd / --cmdserver chgunix \ |
|
39 |
--address $(CHGSOCKNAME) \ |
|
40 |
--config extensions.chgserver= \ |
|
41 |
--config cmdserver.log=/dev/stderr |
|
42 |
||
43 |
.PHONY: clean |
|
44 |
clean: |
|
45 |
$(RM) $(OBJS) |
|
46 |
||
47 |
.PHONY: distclean |
|
48 |
distclean: |
|
49 |
$(RM) $(OBJS) $(TARGET) |