-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (30 loc) · 982 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
BINDIR = $(PREFIX)/bin
CONFFILE = /etc/ntpd.conf
CTLSOCKET = /run/ntpd.sock
DRIFTFILE = /var/lib/ntpd.drift
USERNAME = ntp
CFLAGS = -O2 -Wall
LIBS = -ltls -lm
COMPAT != uname -s | tr A-Z a-z
CCFLAGS = $(CFLAGS) $(LDFLAGS) -I$(COMPAT) -Isrc -D_GNU_SOURCE
CCFLAGS += -DCONFFILE=\"$(CONFFILE)\"
CCFLAGS += -DCTLSOCKET=\"$(CTLSOCKET)\"
CCFLAGS += -DDRIFTFILE=\"$(DRIFTFILE)\"
CCFLAGS += -DNTPD_USER=\"$(USERNAME)\"
all: ntpd
clean:
rm -f ntpd src/parse.c
ntpd: src/*.[ch] src/parse.c $(COMPAT)/*.[ch] Makefile
$(CC) $(CCFLAGS) -o ntpd src/*.c $(COMPAT)/*.c $(LIBS)
src/parse.c: src/parse.y Makefile
$(YACC) -o src/parse.c src/parse.y
install: ntpd
mkdir -p $(DESTDIR)$(BINDIR)
install -s ntpd $(DESTDIR)$(BINDIR)
ln -f $(DESTDIR)$(BINDIR)/{ntpd,ntpq}
if test -n "$(MANDIR)"; then \
mkdir -p $(DESTDIR)$(MANDIR)/{man5,man8}; \
install -m 0644 man/*.5 $(DESTDIR)$(MANDIR)/man5; \
install -m 0644 man/*.8 $(DESTDIR)$(MANDIR)/man8; \
fi
.PHONY: all clean install