Implement a config.h to move defines off the compile line and reduce builds

This commit is contained in:
Douglas Clowes
2013-08-01 13:02:13 +10:00
parent 69925baaf6
commit df7afb367a
3 changed files with 33 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ PSI_LIBS = \
$(LIB_TCL8) $(LIB_HDF5) -lpthread \
-ldl -lz -lm -lc $(LIB_MXML) $(LIB_JSON)
PSI_CFLAGS += -MMD
PSI_CFLAGS += -DSITE_ANSTO=1
PSI_CFLAGS += -DSITE_ANSTO
../%.o : ../%.c
cd ..; $(CC) -c $(PSI_CFLAGS) $*.c -o $*.o
@@ -104,26 +104,12 @@ ifeq (,$(LIB_HTTP))
$(warning LIB_HTTP not found)
endif
SICS_SITE = $(shell bash extract_version.sh SITE)
SICS_VERSION = $(shell bash extract_version.sh VERSION)
SICS_REVISION = $(shell bash extract_version.sh REVISION)
$(info Site text is "${SICS_SITE}")
$(info Version text is "${SICS_VERSION}")
$(info Revision text is "${SICS_REVISION}")
ifneq (,$(wildcard site_ansto.o))
$(info Removing site_ansto.o to force recompile)
$(shell rm -f site_ansto.o)
endif
#
DEBUGFLAGS = -Wall -Wextra -Wno-unused -Wno-comment -Wno-switch
CFLAGS = -g -std=gnu99
CFLAGS += $(INCFLAGS)
CFLAGS += $(DEBUGFLAGS)
CFLAGS += -MMD
CFLAGS += -DSICS_SITE='"${SICS_SITE}"'
CFLAGS += -DSICS_VERSION='"${SICS_VERSION}"'
CFLAGS += -DSICS_REVISION='"${SICS_REVISION}"'
SRC = ./../..
SITENAME = _ansto
@@ -177,9 +163,15 @@ OBJ= site_ansto.o anstoutil.o\
beamstopaction.o action.o \
tclClock.o tclDate.o tclUnixTime.o
all: ../matrix/libmatrix.a $(COREOBJ:%=../%) $(EXTRA:%=../%) libansto.a libhardsup
all: config ../matrix/libmatrix.a $(COREOBJ:%=../%) $(EXTRA:%=../%) libansto.a libhardsup
$(CC) -g -o SICServer $(COREOBJ:%=../%) $(EXTRA:%=../%) $(SUBLIBS) $(PSI_SLIBS:%=../%) $(PSI_LIBS) $(GHTTP_LIBS)
config:
@bash make_config.sh
xref: all
python xref.py $(COREOBJ:%=../%) $(EXTRA:%=../%) $(SUBLIBS) $(PSI_SLIBS:%=../%) $(PSI_LIBS) $(GHTTP_LIBS)
#TODO Add targets for other instruments
echidna: all
make -C instrument/hrpd