author | Yuya Nishihara <yuya@tcha.org> |
Sat, 24 Sep 2016 19:58:23 +0900 | |
changeset 30018 | 2963fba2d18a |
parent 28605 | baa073200ba2 |
child 30522 | ff7df4bb75de |
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 |
|
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 |
||
27 |
chg.o: hgclient.h util.h |
|
28 |
hgclient.o: hgclient.h util.h |
|
29 |
util.o: util.h |
|
30 |
||
31 |
.PHONY: install |
|
32 |
install: $(TARGET) |
|
33 |
install -d $(DESTDIR)$(PREFIX)/bin |
|
34 |
install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin |
|
35 |
install -d $(DESTDIR)$(MANDIR) |
|
36 |
install -m 644 chg.1 $(DESTDIR)$(MANDIR) |
|
37 |
||
38 |
.PHONY: serve |
|
39 |
serve: |
|
40 |
[ -d $(CHGSOCKDIR) ] || ( umask 077; mkdir $(CHGSOCKDIR) ) |
|
41 |
$(HG) serve --cwd / --cmdserver chgunix \ |
|
42 |
--address $(CHGSOCKNAME) \ |
|
43 |
--config extensions.chgserver= \ |
|
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) |