Navigation Menu

Skip to content

Commit

Permalink
Fix dependencies
Browse files Browse the repository at this point in the history
Simplify the dependencies and the build.
  • Loading branch information
alandekok committed Oct 23, 2015
1 parent 067a401 commit 63e6521
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 44 deletions.
7 changes: 4 additions & 3 deletions scripts/boiler.mk
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -591,6 +591,7 @@ endif

# Define compilers and linkers
#
BOOTSTRAP_BUILD =
COMPILE.c = ${CC}
COMPILE.cxx = ${CXX}
CPP = cc -E
Expand Down
11 changes: 0 additions & 11 deletions 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
57 changes: 28 additions & 29 deletions 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 \
Expand All @@ -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 ]
Expand All @@ -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 $@
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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))

######################################################################
#
Expand Down Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion src/include/build.h
Expand Up @@ -10,7 +10,6 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <freeradius-devel/autoconf.h> /* Needed for endian macros */

/*
* The ubiquitous stringify macros
Expand Down

1 comment on commit 63e6521

@alllexx88
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is a much better way to satisfy dynamically built headers dependencies, thanks

Please sign in to comment.