From 63e65210f6998e0f663a5558b767bd49e507a350 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Fri, 23 Oct 2015 10:51:38 -0400 Subject: [PATCH] Fix dependencies Simplify the dependencies and the build. --- scripts/boiler.mk | 7 +++--- src/all.mk | 11 --------- src/include/all.mk | 57 ++++++++++++++++++++++----------------------- src/include/build.h | 1 - 4 files changed, 32 insertions(+), 44 deletions(-) diff --git a/scripts/boiler.mk b/scripts/boiler.mk index c36a9d23b85e..2dc922e42cbb 100644 --- a/scripts/boiler.mk +++ b/scripts/boiler.mk @@ -128,7 +128,7 @@ endef # ifeq "${CPP_MAKEDEPEND}" "yes" define ADD_OBJECT_RULE -$${BUILD_DIR}/objs/%.${OBJ_EXT} $${BUILD_DIR}/objs/%.d: ${1} ${JLIBTOOL} +$${BUILD_DIR}/objs/%.${OBJ_EXT} $${BUILD_DIR}/objs/%.d: ${1} | ${BOOTSTRAP_BUILD} ${2} $${CPP} $${CPPFLAGS} $$(addprefix -I,$${SRC_INCDIRS}) $${SRC_DEFS} $$< | sed \ -n 's,^\# *[0-9][0-9]* *"\([^"]*\)".*,$$@: \1,p' > $${BUILD_DIR}/objs/$$*.d @@ -137,14 +137,14 @@ endef else define ADD_OBJECT_RULE -$${BUILD_DIR}/objs/%.${OBJ_EXT} $${BUILD_DIR}/objs/%.d: ${1} ${JLIBTOOL} +$${BUILD_DIR}/objs/%.${OBJ_EXT} $${BUILD_DIR}/objs/%.d: ${1} | ${BOOTSTRAP_BUILD} ${2} ${FILTER_DEPENDS} endef endif define ADD_ANALYZE_RULE -$${BUILD_DIR}/plist/%.plist: ${1} ${JLIBTOOL} +$${BUILD_DIR}/plist/%.plist: ${1} ${2} endef @@ -591,6 +591,7 @@ endif # Define compilers and linkers # +BOOTSTRAP_BUILD = COMPILE.c = ${CC} COMPILE.cxx = ${CXX} CPP = cc -E diff --git a/src/all.mk b/src/all.mk index b3dfdbd71c45..d7a8a4ff21f7 100644 --- a/src/all.mk +++ b/src/all.mk @@ -1,15 +1,4 @@ # add this dependency BEFORE including the other submakefiles. all: -# -# This nonsense is here because pattern rules don't work if you have -# multiple of them. If you try to run the shell script by assigning -# it to a variable, GNU Make notices that the variable isn't used... -# and doesn't run the shell script. This crap below seems to bypass -# Make's optimization. -# -ifeq "$(shell [ -e src/freeradius-devel ] || ln -s include src/freeradius-devel)" "" -# do nothing -endif - SUBMAKEFILES := include/all.mk lib/all.mk modules/all.mk main/all.mk tests/all.mk diff --git a/src/include/all.mk b/src/include/all.mk index fd8ac78a19b5..64579568040e 100644 --- a/src/include/all.mk +++ b/src/include/all.mk @@ -1,20 +1,31 @@ # # Version: $Id$ # + +# +# Build dynamic headers by substituting various values from autoconf.h, these +# get installed with the library files, so external programs can tell what +# the server library was built with. +# +# The RFC headers are dynamic, too. +# +# The rest of the headers are static. +# + +HEADERS_DY = attributes.h features.h missing.h radpaths.h tls.h + + HEADERS = \ - attributes.h \ build.h \ conf.h \ conffile.h \ detail.h \ event.h \ - features.h \ hash.h \ heap.h \ libradius.h \ md4.h \ md5.h \ - missing.h \ modcall.h \ modules.h \ packet.h \ @@ -29,15 +40,8 @@ HEADERS = \ token.h \ udpfromto.h \ base64.h \ - map.h - -# -# Build dynamic headers by substituting various values from autoconf.h, these -# get installed with the library files, so external programs can tell what -# the server library was built with. -# -HEADERS_DY = src/include/features.h src/include/missing.h src/include/tls.h \ - src/include/radpaths.h src/include/attributes.h + map.h \ + $(HEADERS_DY) # # Solaris awk doesn't recognise [[:blank:]] hence [\t ] @@ -60,6 +64,7 @@ src/include/autoconf.sed: src/include/autoconf.h RFC_DICTS := $(filter-out %~,$(wildcard share/dictionary.rfc*)) RFC_HEADERS := $(patsubst share/dictionary.%,src/include/%.h,$(RFC_DICTS)) +HEADERS += $(notdir ${RFC_HEADERS}) src/include/attributes.h: share/dictionary.freeradius.internal @$(ECHO) HEADER $@ @@ -71,15 +76,6 @@ src/include/%.h: share/dictionary.% share/dictionary.vqp @$(ECHO) HEADER $@ @grep ^ATTRIBUTE $< | awk '{print "PW_"$$2 " " $$3 " //!< AUTOGENERATED ATTRIBUTE DEFINITION"}' | tr '[:lower:]' '[:upper:]' | tr -- - _ | sed 's/^/#define /' > $@ -src/include/radius.h: | src/include/attributes.h $(RFC_HEADERS) src/include/vqp.h - -# -# So the headers are created before we compile anything -# -$(JLIBTOOL): src/include/radius.h - -src/freeradius-devel/features.h: src/include/features.h src/freeradius-devel - # # Build features.h by copying over WITH_* and RADIUSD_VERSION_* # preprocessor macros from autoconf.h @@ -94,8 +90,6 @@ src/include/features.h: src/include/features-h src/include/autoconf.h @grep "^#define[ ]*WITH_" src/include/autoconf.h >> $@ @grep "^#define[ ]*RADIUSD_VERSION" src/include/autoconf.h >> $@ -src/freeradius-devel/missing.h: src/include/missing.h src/freeradius-devel - # # Use the SED script we built earlier to make permanent substitutions # of definitions in missing-h to build missing.h @@ -104,19 +98,24 @@ src/include/missing.h: src/include/missing-h src/include/autoconf.sed @$(ECHO) HEADER $@ @sed -f src/include/autoconf.sed < $< > $@ -src/freeradius-devel/tls.h: src/include/tls.h src/freeradius-devel - src/include/tls.h: src/include/tls-h src/include/autoconf.sed @$(ECHO) HEADER $@ @sed -f src/include/autoconf.sed < $< > $@ -src/freeradius-devel/radpaths.h: src/include/radpaths.h src/freeradius-devel - src/include/radpaths.h: src/include/build-radpaths-h @$(ECHO) HEADER $@ @cd src/include && /bin/sh build-radpaths-h -${BUILD_DIR}/make/jlibtool: $(HEADERS_DY) +# +# Create the soft link for the fake include file path. +# +src/freeradius-devel: + @[ -e $@ ] || ln -s include $@ + +# +# Ensure we set up the build environment +# +BOOTSTRAP_BUILD += src/freeradius-devel $(addprefix src/include/,$(HEADERS_DY)) ###################################################################### # @@ -149,7 +148,7 @@ install: install.src.include # .PHONY: clean.src.include distclean.src.include clean.src.include: - @rm -f $(HEADERS_DY) + @rm -f $(addprefix src/include/,$(HEADERS_DY)) clean: clean.src.include diff --git a/src/include/build.h b/src/include/build.h index fe63f17f79eb..9fa4a1f51097 100644 --- a/src/include/build.h +++ b/src/include/build.h @@ -10,7 +10,6 @@ #ifdef __cplusplus extern "C" { #endif -#include /* Needed for endian macros */ /* * The ubiquitous stringify macros