summaryrefslogtreecommitdiffstats
path: root/Makefile.in
blob: 318109bb468ab0fee6df94f7e24432b3e9900bbb (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
##################################################
#
# chronyd/chronyc - Programs for keeping computer clocks accurate.
# 
# Copyright (C) Richard P. Curnow  1997-2003
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# =======================================================================
#
# Makefile template

SYSCONFDIR = @SYSCONFDIR@
BINDIR = @BINDIR@
SBINDIR = @SBINDIR@
LOCALSTATEDIR = @LOCALSTATEDIR@
CHRONYVARDIR = @CHRONYVARDIR@
DESTDIR =

CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@

GETDATE_CFLAGS = @GETDATE_CFLAGS@

EXTRA_OBJS = @EXTRA_OBJS@

OBJS = array.o cmdparse.o conf.o leapdb.o local.o logging.o main.o memory.o quantiles.o \
       reference.o regress.o rtc.o samplefilt.o sched.o socket.o sources.o sourcestats.o \
       stubs.o smooth.o sys.o sys_null.o tempcomp.o util.o $(EXTRA_OBJS)

EXTRA_CLI_OBJS = @EXTRA_CLI_OBJS@

CLI_OBJS = array.o client.o cmdparse.o getdate.o memory.o nameserv.o \
           pktlength.o socket.o util.o $(EXTRA_CLI_OBJS)

ALL_OBJS = $(OBJS) $(CLI_OBJS)

LIBS = @LIBS@
EXTRA_LIBS = @EXTRA_LIBS@
EXTRA_CLI_LIBS = @EXTRA_CLI_LIBS@

# Until we have a main procedure we can link, just build object files
# to test compilation

all : chronyd chronyc

chronyd : $(OBJS)
	$(CC) $(CFLAGS) -o chronyd $(OBJS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS)

chronyc : $(CLI_OBJS)
	$(CC) $(CFLAGS) -o chronyc $(CLI_OBJS) $(LDFLAGS) $(LIBS) $(EXTRA_CLI_LIBS)

getdate.o: CFLAGS += $(GETDATE_CFLAGS)

distclean : clean
	$(MAKE) -C doc distclean
	$(MAKE) -C test/unit distclean
	-rm -f .DS_Store
	-rm -f Makefile config.h config.log

clean :
	$(MAKE) -C test/unit clean
	-rm -f *.o *.s chronyc chronyd core.* *~
	-rm -f *.gcda *.gcno
	-rm -rf .deps
	-rm -rf *.dSYM

getdate.c : getdate.y
	bison -o getdate.c getdate.y

# This can be used to force regeneration of getdate.c
getdate :
	bison -o getdate.c getdate.y

# For install, don't use the install command, because its switches
# seem to vary between systems.

install: chronyd chronyc
	[ -d $(DESTDIR)$(SYSCONFDIR) ] || mkdir -p $(DESTDIR)$(SYSCONFDIR)
	[ -d $(DESTDIR)$(SBINDIR) ] || mkdir -p $(DESTDIR)$(SBINDIR)
	[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
	[ -d $(DESTDIR)$(CHRONYVARDIR) ] || mkdir -p $(DESTDIR)$(CHRONYVARDIR)
	if [ -f $(DESTDIR)$(SBINDIR)/chronyd ]; then rm -f $(DESTDIR)$(SBINDIR)/chronyd ; fi
	if [ -f $(DESTDIR)$(BINDIR)/chronyc ]; then rm -f $(DESTDIR)$(BINDIR)/chronyc ; fi
	cp chronyd $(DESTDIR)$(SBINDIR)/chronyd
	chmod 755 $(DESTDIR)$(SBINDIR)/chronyd
	cp chronyc $(DESTDIR)$(BINDIR)/chronyc
	chmod 755 $(DESTDIR)$(BINDIR)/chronyc
	$(MAKE) -C doc install

docs :
	$(MAKE) -C doc docs

install-docs :
	$(MAKE) -C doc install-docs

%.o : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<

%.s : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -S $<

quickcheck : chronyd chronyc
	$(MAKE) -C test/unit check
	cd test/simulation && ./run
	cd test/system && ./run

check : chronyd chronyc
	$(MAKE) -C test/unit check
	cd test/simulation && ./run -i 20 -m 2
	cd test/system && ./run

print-chronyd-objects :
	@echo $(OBJS)

Makefile : Makefile.in configure
	@echo
	@echo Makefile needs to be regenerated, run ./configure
	@echo
	@exit 1

.deps:
	@mkdir .deps

.deps/%.d: %.c | .deps
	@$(CC) -MM $(CPPFLAGS) -MT '$(<:%.c=%.o) $@' $< -o $@

ifndef NODEPS
-include $(ALL_OBJS:%.o=.deps/%.d)
endif