######################################################################### # # $Id: Makefile 1.8 2021/11/19 14:34:50 martin.burnicki REL_M $ # # Description: # Makefile for ntptest. # # ----------------------------------------------------------------------- # $Log: Makefile $ # Revision 1.8 2021/11/19 14:34:50 martin.burnicki # If built from a git repo, use the version from git preferably. # Some cleanup. # Revision 1.7 2020/04/01 16:31:11 martin # Add defines to support openSSL CMAC. # Revision 1.6 2018/07/31 16:03:44 martin # Conditionally support NTP auth. # Revision 1.5 2018/07/31 12:13:11 martin # Support silent build. # Revision 1.4 2018/03/09 09:58:03 martin # Added new module mbgntp.o. # Revision 1.2 2016/08/05 12:40:28 martin # Account for modified directory structure. # Makefile has been moved to subdirectory unix/. # Added some library modules. # Revision 1.1 2014/04/01 13:02:21 martin # Initial revision. # ######################################################################### TARGET = ntptest USE_MBG_NTP_AUTH ?= 1 # Set V to 1 to build verbosely. V ?= 0 # The lines below make the build output non-verbose by default. # Call make with parameter "V=1" to get verbose output. ifneq ("$(V)","0") Q := QM := vecho = @true else Q := @ QM := -s vecho = @echo endif NTPTEST_VERSION = $(shell git describe --tags 2>/dev/null) MBGLIB = ../mbglib MBGLIB_DIRS = common OBJS = $(TARGET).o OBJS += mbgntp.o OBJS += mbg_ntp_test_util.o OBJS += timeutil.o OBJS += str_util.o OBJS += mbgerror.o ifdef DEBUG CPPFLAGS += -g2 CPPFLAGS += -DDEBUG=$(DEBUG) else CPPFLAGS += -O2 endif CPPFLAGS += -Wall CPPFLAGS += $(foreach dir,$(MBGLIB_DIRS),-I$(MBGLIB)/$(dir)) LDFLAGS += -lrt # Conditionally support NTP authentication. ifneq ("$(USE_MBG_NTP_AUTH)","0") CPPFLAGS += -D_USE_MBG_NTP_AUTH=$(USE_MBG_NTP_AUTH) CPPFLAGS += -DHAVE_OPENSSL_CMAC_H CPPFLAGS += -DENABLE_CMAC OBJS += mbg_ntp_auth.o LDFLAGS += -lcrypto LDFLAGS += -lm # Requires the math library. endif ifneq ($(NTPTEST_VERSION),) CPPFLAGS += -DNTPTEST_VERSION=$(NTPTEST_VERSION) endif VPATH += .. VPATH += $(foreach dir,$(MBGLIB_DIRS),$(MBGLIB)/$(dir)) %.o: %.c $(vecho) " $(CC) $@" $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< .PHONY: all all: $(TARGET) $(TARGET): $(OBJS) $(vecho) " Linking $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) .PHONY: clean clean: rm -f *.o *~ core rm -f $(TARGET)