#
# Makefile.tmpl,v 3.1 1993/07/06 01:11:10 jbj Exp
#
PROGRAM=	xntpd
#
# xntpd - NTP daemon
#
COMPILER= cc
COPTS= -O
BINDIR=	/usr/local
INSTALL= install
DEFS=
DEFS_LOCAL=
CLOCKDEFS=
DAEMONLIBS=
RESLIB=
ADJLIB=
COMPAT=
#
INCL=		-I../include
CFLAGS=		$(COPTS) $(DEFS) $(DEFS_LOCAL) $(INCL)
CC=		$(COMPILER)
LIB=		../lib/libntp.a
LINTLIB=	../lib/llib-llibntp.ln
MAKE=		make
#
SOURCE=	ntp_config.c ntp_control.c ntp_io.c ntp_leap.c \
	ntp_loopfilter.c ntp_monitor.c ntp_peer.c ntp_proto.c \
	ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \
	ntp_unixclock.c ntp_util.c ntpd.c refclock_chu.c \
	refclock_conf.c refclock_local.c refclock_pst.c \
	refclock_wwvb.c refclock_goes.c refclock_mx4200.c \
	refclock_parse.c refclock_as2201.c refclock_omega.c \
	refclock_tpro.c refclock_leitch.c refclock_irig.c \
	ntp_intres.c ntp_filegen.c

OBJS=	ntp_config.o ntp_control.o ntp_io.o ntp_leap.o \
	ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \
	ntp_refclock.o ntp_request.o ntp_restrict.o ntp_timer.o \
	ntp_unixclock.o ntp_util.o ntpd.o refclock_chu.o \
	refclock_conf.o refclock_local.o refclock_pst.o \
	refclock_wwvb.o refclock_goes.o refclock_mx4200.o \
	refclock_parse.o refclock_as2201.o refclock_omega.o \
	refclock_tpro.o refclock_leitch.o refclock_irig.o \
	ntp_intres.o ntp_filegen.o

all:	$(PROGRAM)

$(PROGRAM): $(OBJS) version.o $(LIB)
	rm -f $(PROGRAM)
	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB) $(DAEMONLIBS) \
		$(RESLIB) $(ADJLIB) $(COMPAT)

install:	$(PROGRAM)
	$(INSTALL) -c -m 0755 $(PROGRAM) $(BINDIR)

tags:
	ctags *.c *.h

depend:
	mkdep $(CFLAGS) $(SOURCE)

clean:
	rm -f $(PROGRAM) *.o *.out tags oxntpd make.log Makefile.bak lint.errs
	rm -f .depend *~

distclean:	clean
	rm -f *.orig *.rej Makefile

lint:	$(LINTLIB)
	lint -x -u $(DEFS) $(INCL) $(LINTLIB) $(SOURCE) >lint.errs

../lib/llib-llibntp.ln:
	cd ../lib ; $(MAKE) $(MFLAGS) lintlib

../lib/libntp.a:
	cd ../lib ; $(MAKE) $(MFLAGS)

#
# These guys require knowledge of our clock configuration
#
refclock_chu.o:		refclock_chu.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_conf.o:	refclock_conf.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_local.o:	refclock_local.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL)  $(CLOCKDEFS) $(INCL) -c $*.c

refclock_pst.o:		refclock_pst.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_goes.o:	refclock_goes.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_wwvb.o:	refclock_wwvb.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_parse.o:	refclock_parse.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_mx4200.o:	refclock_mx4200.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_as2201.o:	refclock_as2201.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_omega.o:	refclock_omega.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_tpro.o:	refclock_tpro.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_leitch.o:	refclock_leitch.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c

refclock_irig.o:	refclock_irig.c
	$(CC) $(COPTS) $(DEFS) $(DEFS_LOCAL) $(CLOCKDEFS) $(INCL) -c $*.c
