28060
|
1 |
HG = hg
|
|
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 progress.assume-tty=1 \
|
|
42 |
--config cmdserver.log=/dev/stderr
|
|
43 |
|
|
44 |
.PHONY: clean
|
|
45 |
clean:
|
|
46 |
$(RM) $(OBJS)
|
|
47 |
|
|
48 |
.PHONY: distclean
|
|
49 |
distclean:
|
|
50 |
$(RM) $(OBJS) $(TARGET)
|