# A long time ago, far, far away, under Solaris, you needed to
#    CFLAGS += -xO2 -Xc
#    LDLIBS += -lnsl -lsocket
#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-start
# Some versions of Linux may need
    CFLAGS +=  -D_GNU_SOURCE
#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-end
# To cross-compile
#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-start
#CC = mips-uclibc-gcc
#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-end
# To check for lint
# -Wundef not recognized by gcc-2.7.2.3
#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-start
#CFLAGS += -std=c99 -W -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow \
 -Waggregate-return -Wnested-externs -Winline -Wwrite-strings -Wstrict-prototypes

#CFLAGS += -O2
CFLAGS += -Os 
CFLAGS += $(EXTRA_CFLAGS)
# CFLAGS += -DPRECISION_SIOCGSTAMP
CFLAGS += -DENABLE_DEBUG
CFLAGS += -DENABLE_REPLAY
# CFLAGS += -DUSE_OBSOLETE_GETTIMEOFDAY

LDFLAGS += -lrt
LDFLAGS += -s
#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-end

all: ntpclient

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

ntpclient: ntpclient.o phaselock.o

ntpclient.o phaselock.o: ntpclient.h

adjtimex: adjtimex.o

#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-start
romfs:
	$(ROMFSINST) /bin/ntpclient
#	WNC Timezone fix, not need to create a symbolic link to var/TZ
#	$(ROMFSINST) -s /var/TZ /etc/TZ
#NMR0000-20160314-Porting NTP client from Laser codebase to Spider codebase-end

clean:
	rm -f ntpclient adjtimex *.o
