
ifndef COMPILING_WHOLE_TREE
TOPDIR=$(shell pwd)/../..
endif

include $(TOPDIR)/Rules.make 


# Under Solaris, you need to 
#    CFLAGS += -xO2 -Xc
#    LDLIBS += -lnsl -lsocket
# Some versions of Linux may need
#    CFLAGS += -D_GNU_SOURCE
# To cross-compile
# CC = mips-uclibc-gcc
# To check for lint
# -Wundef not recognized by gcc-2.7.2.3
CFLAGS += -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow \
 -Waggregate-return -Wnested-externs -Winline -Wwrite-strings \
 -Wstrict-prototypes -I$(TOPDIR)/libs

CFLAGS += -O

all: ntpclient

test: ntpclient
	./ntpclient -d -r <test.dat

ntpclient: ntpclient.o phaselock.o -lconf

adjtimex: adjtimex.o

clean:
	rm -f ntpclient adjtimex *.o
release:
	$(INSTALL) -g root -o root -m 755 ntpclient $(ROOT_FS_DIR)/usr/bin/
	$(INSTALL) -d $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
	$(INSTALL) -m 644 -o root -g root zoneinfo/Europe/Paris $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
	$(INSTALL) -m 644 -o root -g root zoneinfo/Europe/London $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
	$(INSTALL) -m 644 -o root -g root zoneinfo/Europe/Madrid $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
	$(INSTALL) -m 644 -o root -g root zoneinfo/Europe/Rome $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
	$(INSTALL) -m 644 -o root -g root zoneinfo/Europe/Amsterdam $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
	$(INSTALL) -m 644 -o root -g root zoneinfo/Europe/Brussels $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
	$(INSTALL) -m 644 -o root -g root zoneinfo/Europe/Berlin $(ROOT_FS_DIR)/usr/share/zoneinfo/Europe
