Show More
@@ -1,52 +1,52 b'' | |||||
1 | HG = $(CURDIR)/../../hg |
|
1 | HG = $(CURDIR)/../../hg | |
2 |
|
2 | |||
3 | TARGET = chg |
|
3 | TARGET = chg | |
4 | SRCS = chg.c hgclient.c procutil.c util.c |
|
4 | SRCS = chg.c hgclient.c procutil.c util.c | |
5 | OBJS = $(SRCS:.c=.o) |
|
5 | OBJS = $(SRCS:.c=.o) | |
6 |
|
6 | |||
7 | CFLAGS ?= -O2 -Wall -Wextra -pedantic -g |
|
7 | CFLAGS ?= -O2 -Wall -Wextra -pedantic -g | |
8 | CPPFLAGS ?= -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE |
|
8 | CPPFLAGS ?= -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE | |
9 | override CFLAGS += -std=gnu99 |
|
9 | override CFLAGS += -std=gnu99 | |
10 | ifdef HGPATH |
|
10 | ifdef HGPATH | |
11 | override CPPFLAGS += -DHGPATH=\"$(HGPATH)\" |
|
11 | override CPPFLAGS += -DHGPATH=\"$(HGPATH)\" | |
12 | endif |
|
12 | endif | |
13 |
|
13 | |||
14 | DESTDIR = |
|
14 | DESTDIR = | |
15 | PREFIX = /usr/local |
|
15 | PREFIX = /usr/local | |
16 | MANDIR = $(PREFIX)/share/man/man1 |
|
16 | MANDIR = $(PREFIX)/share/man/man1 | |
17 |
|
17 | |||
18 | CHGSOCKDIR = /tmp/chg$(shell id -u) |
|
18 | CHGSOCKDIR = /tmp/chg$(shell id -u) | |
19 | CHGSOCKNAME = $(CHGSOCKDIR)/server |
|
19 | CHGSOCKNAME = $(CHGSOCKDIR)/server | |
20 |
|
20 | |||
21 | .PHONY: all |
|
21 | .PHONY: all | |
22 | all: $(TARGET) |
|
22 | all: $(TARGET) | |
23 |
|
23 | |||
24 | $(TARGET): $(OBJS) |
|
24 | $(TARGET): $(OBJS) | |
25 | $(CC) $(LDFLAGS) -o $@ $(OBJS) |
|
25 | $(CC) $(LDFLAGS) -o $@ $(OBJS) | |
26 |
|
26 | |||
27 | chg.o: hgclient.h procutil.h util.h |
|
27 | chg.o: hgclient.h procutil.h util.h | |
28 | hgclient.o: hgclient.h procutil.h util.h |
|
28 | hgclient.o: hgclient.h procutil.h util.h | |
29 | procutil.o: procutil.h util.h |
|
29 | procutil.o: procutil.h util.h | |
30 | util.o: util.h |
|
30 | util.o: util.h | |
31 |
|
31 | |||
32 | .PHONY: install |
|
32 | .PHONY: install | |
33 | install: $(TARGET) |
|
33 | install: $(TARGET) | |
34 | install -d $(DESTDIR)$(PREFIX)/bin |
|
34 | install -d "$(DESTDIR)$(PREFIX)"/bin | |
35 | install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin |
|
35 | install -m 755 "$(TARGET)" "$(DESTDIR)$(PREFIX)"/bin | |
36 | install -d $(DESTDIR)$(MANDIR) |
|
36 | install -d "$(DESTDIR)$(MANDIR)" | |
37 | install -m 644 chg.1 $(DESTDIR)$(MANDIR) |
|
37 | install -m 644 chg.1 "$(DESTDIR)$(MANDIR)" | |
38 |
|
38 | |||
39 | .PHONY: serve |
|
39 | .PHONY: serve | |
40 | serve: |
|
40 | serve: | |
41 | [ -d $(CHGSOCKDIR) ] || ( umask 077; mkdir $(CHGSOCKDIR) ) |
|
41 | [ -d "$(CHGSOCKDIR)" ] || ( umask 077; mkdir "$(CHGSOCKDIR)" ) | |
42 | $(HG) serve --cwd / --cmdserver chgunix \ |
|
42 | "$(HG)" serve --cwd / --cmdserver chgunix \ | |
43 | --address $(CHGSOCKNAME) \ |
|
43 | --address $(CHGSOCKNAME) \ | |
44 | --config cmdserver.log=/dev/stderr |
|
44 | --config cmdserver.log=/dev/stderr | |
45 |
|
45 | |||
46 | .PHONY: clean |
|
46 | .PHONY: clean | |
47 | clean: |
|
47 | clean: | |
48 | $(RM) $(OBJS) |
|
48 | $(RM) $(OBJS) | |
49 |
|
49 | |||
50 | .PHONY: distclean |
|
50 | .PHONY: distclean | |
51 | distclean: |
|
51 | distclean: | |
52 | $(RM) $(OBJS) $(TARGET) |
|
52 | $(RM) $(OBJS) $(TARGET) |
General Comments 0
You need to be logged in to leave comments.
Login now