]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Update boiler make build system to generate dynamic headers
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 7 Nov 2012 13:01:03 +0000 (13:01 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 7 Nov 2012 13:01:03 +0000 (13:01 +0000)
src/include/all.mk
src/modules/all.mk

index e5e2bd25c1e774b2b19f7d263585201a4407a5a2..fce253f45d6d206d3229c87170e7f23e8cea1d04 100644 (file)
@@ -4,18 +4,52 @@
 # Version:     $Id$
 #
 
-HEADERS        = autoconf.h conf.h conffile.h detail.h dhcp.h event.h hash.h heap.h \
+HEADERS        = conf.h conffile.h detail.h dhcp.h event.h features.h hash.h heap.h \
        ident.h libradius.h md4.h md5.h missing.h modcall.h modules.h \
        packet.h rad_assert.h radius.h radiusd.h radpaths.h \
        radutmp.h realms.h sha1.h stats.h sysutmp.h token.h \
        udpfromto.h vmps.h vqp.h base64.h
 
-# Our target
-TARGET := src/include/radpaths.h
+TARGET := src/include/radpaths.h
 
 src/include/radpaths.h: src/include/build-radpaths-h
        cd src/include && /bin/sh build-radpaths-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_AC = src/include/missing.h src/include/tls.h
+HEADERS_DY = src/include/autoconf.sed src/include/features.h $(HEADERS_AC)
+
+define clean_others
+@rm -f $(HEADERS_DY)
+endef
+
+TGT_POSTCLEAN := ${clean_others}
+
+all: $(HEADERS_DY)
+
+src/include/features.h:
+       @cp src/include/features-h src/include/features.h
+       @grep -o "^\#define\s*WITH_.*" src/include/autoconf.h >> src/include/features.h
+       
+src/include/autoconf.sed:
+       @grep ^#define src/include/autoconf.h | sed 's,/\*\*/,1,;' | awk '{print "\
+       s,#[[:blank:]]*ifdef[[:blank:]]*" $$2 ",#if "$$3 ",g;\
+       s,#[[:blank:]]*ifndef[[:blank:]]*" $$2 ",#if !"$$3 ",g;\
+       s,defined(" $$2 ")," $$3 ",g;\
+       s," $$2 ","$$3 ",g;"}' > src/include/autoconf.sed
+
+$(HEADERS_AC): src/include/autoconf.sed
+       @sed -f src/include/autoconf.sed < `echo $@ | sed 's/\\./-/'` > $@
+
+#
+#  Installation
+#
+
 # global install depends on the local rule
 install: install.src.include
 
index fb41496342958d7151245ad682bee053a6b21048..9aa303d1956a548ed20dad42ab2e6491c3a8c556 100644 (file)
@@ -1 +1,7 @@
+#
+#  Changes the behaviour of autoconf.h to undef definitions that would conflict
+#  with module config.h files.
+#
+CFLAGS += -DIS_MODULE=1
+
 SUBMAKEFILES := $(wildcard ${top_srcdir}/src/modules/rlm_*/all.mk)