Implement a driver which allows using PTP hardware clock (PHC) as a reference clock. It uses the PTP_SYS_OFFSET ioctl or clock_gettime() to measure the offset between the PTP clock and the system clock. Ten readings are made for every driver poll and the fastest one is returned. As PHCs are typically kept in TAI instead of UTC, it's necessary to set the TAI/UTC offset manually by the offset option. This could be improved by obtaining the offset automatically from the right/UTC timezone.
164 lines
5.2 KiB
Makefile
164 lines
5.2 KiB
Makefile
##################################################
|
|
#
|
|
# 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@
|
|
MANDIR=@MANDIR@
|
|
INFODIR=@INFODIR@
|
|
DOCDIR=@DOCDIR@
|
|
LOCALSTATEDIR=@LOCALSTATEDIR@
|
|
CHRONYVARDIR=@CHRONYVARDIR@
|
|
|
|
CC = @CC@
|
|
CFLAGS = @CFLAGS@
|
|
CPPFLAGS = @CPPFLAGS@
|
|
|
|
DESTDIR=
|
|
|
|
HASH_OBJ = @HASH_OBJ@
|
|
|
|
OBJS = util.o sched.o regress.o local.o \
|
|
sys.o main.o ntp_io.o ntp_core.o ntp_sources.o \
|
|
sources.o sourcestats.o reference.o \
|
|
logging.o conf.o cmdmon.o keys.o \
|
|
nameserv.o acquire.o manual.o addrfilt.o \
|
|
cmdparse.o mkdirpp.o rtc.o pktlength.o clientlog.o \
|
|
broadcast.o refclock.o refclock_phc.o refclock_pps.o \
|
|
refclock_shm.o refclock_sock.o tempcomp.o $(HASH_OBJ)
|
|
|
|
EXTRA_OBJS=@EXTRA_OBJECTS@
|
|
|
|
CLI_OBJS = client.o nameserv.o getdate.o cmdparse.o \
|
|
pktlength.o util.o $(HASH_OBJ)
|
|
|
|
ALL_OBJS = $(OBJS) $(EXTRA_OBJS) $(CLI_OBJS)
|
|
|
|
LDFLAGS = @LDFLAGS@
|
|
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) $(EXTRA_OBJS)
|
|
$(CC) $(CFLAGS) -o chronyd $(OBJS) $(EXTRA_OBJS) $(LDFLAGS) @HASH_LINK@ $(LIBS) $(EXTRA_LIBS)
|
|
|
|
chronyc : $(CLI_OBJS)
|
|
$(CC) $(CFLAGS) -o chronyc $(CLI_OBJS) $(LDFLAGS) @READLINE_LINK@ @HASH_LINK@ $(LIBS) $(EXTRA_CLI_LIBS)
|
|
|
|
client.o : client.c
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) @READLINE_COMPILE@ -c $<
|
|
|
|
$(HASH_OBJ) : $(patsubst %.o,%.c,$(HASH_OBJ))
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) @HASH_COMPILE@ -c $<
|
|
|
|
distclean : clean
|
|
-rm -f Makefile
|
|
-rm -f chrony.conf.5 chrony.texi chronyc.1 chronyd.8
|
|
|
|
clean :
|
|
-rm -f *.o *.s chronyc chronyd core *~ chrony.info chrony.html chrony.txt
|
|
-rm -rf .deps
|
|
|
|
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)$(DOCDIR) ] || mkdir -p $(DESTDIR)$(DOCDIR)
|
|
[ -d $(DESTDIR)$(MANDIR)/man1 ] || mkdir -p $(DESTDIR)$(MANDIR)/man1
|
|
[ -d $(DESTDIR)$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)$(MANDIR)/man5
|
|
[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
|
|
[ -d $(DESTDIR)$(DOCDIR) ] || mkdir -p $(DESTDIR)$(DOCDIR)
|
|
[ -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
|
|
cp chrony.txt $(DESTDIR)$(DOCDIR)/chrony.txt
|
|
chmod 644 $(DESTDIR)$(DOCDIR)/chrony.txt
|
|
cp COPYING $(DESTDIR)$(DOCDIR)/COPYING
|
|
chmod 644 $(DESTDIR)$(DOCDIR)/COPYING
|
|
cp README $(DESTDIR)$(DOCDIR)/README
|
|
chmod 644 $(DESTDIR)$(DOCDIR)/README
|
|
cp chrony.1 $(DESTDIR)$(MANDIR)/man1
|
|
chmod 644 $(DESTDIR)$(MANDIR)/man1/chrony.1
|
|
cp chronyc.1 $(DESTDIR)$(MANDIR)/man1
|
|
chmod 644 $(DESTDIR)$(MANDIR)/man1/chronyc.1
|
|
cp chronyd.8 $(DESTDIR)$(MANDIR)/man8
|
|
chmod 644 $(DESTDIR)$(MANDIR)/man8/chronyd.8
|
|
cp chrony.conf.5 $(DESTDIR)$(MANDIR)/man5
|
|
chmod 644 $(DESTDIR)$(MANDIR)/man5/chrony.conf.5
|
|
|
|
%.o : %.c
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
|
|
|
%.s : %.c
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -S $<
|
|
|
|
install-docs : docs
|
|
[ -d $(DESTDIR)$(DOCDIR) ] || mkdir -p $(DESTDIR)$(DOCDIR)
|
|
cp chrony.txt $(DESTDIR)$(DOCDIR)/chrony.txt
|
|
chmod 644 $(DESTDIR)$(DOCDIR)/chrony.txt
|
|
cp chrony.html $(DESTDIR)$(DOCDIR)/chrony.html
|
|
chmod 644 $(DESTDIR)$(DOCDIR)/chrony.html
|
|
[ -d $(DESTDIR)$(INFODIR) ] || mkdir -p $(DESTDIR)$(INFODIR)
|
|
cp chrony.info* $(DESTDIR)$(INFODIR)
|
|
chmod 644 $(DESTDIR)$(INFODIR)/chrony.info*
|
|
|
|
docs : chrony.txt chrony.html chrony.info
|
|
|
|
chrony.txt : chrony.texi
|
|
makeinfo --no-headers --number-sections -o chrony.txt chrony.texi
|
|
|
|
chrony.html : chrony.texi
|
|
command -v texi2html > /dev/null 2>&1 && texi2html chrony.texi || \
|
|
makeinfo --no-split --html --number-sections -o chrony.html chrony.texi
|
|
|
|
chrony.info : chrony.texi
|
|
makeinfo chrony.texi
|
|
|
|
# This is only relevant if you're maintaining the website!
|
|
faq.php : faq.txt faqgen.pl
|
|
perl faqgen.pl < faq.txt > faq.php
|
|
|
|
.deps:
|
|
@mkdir .deps
|
|
|
|
.deps/%.d: %.c | .deps
|
|
@$(CC) -MM $(CPPFLAGS) -MT '$(<:%.c=%.o) $@' $< -o $@
|
|
|
|
-include $(ALL_OBJS:%.o=.deps/%.d)
|