]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fix "install include" file rules
authorAlan T. DeKok <aland@freeradius.org>
Tue, 19 Mar 2019 12:34:04 +0000 (08:34 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 19 Mar 2019 12:34:04 +0000 (08:34 -0400)
src/lib/all.mk

index 63a2523721bbed04f3dd42abd394913e3d45429b..dadc5bef743e452abd842ce80406e5cc05f022ab 100644 (file)
@@ -6,7 +6,7 @@ define LIB_INCLUDE
 #  This is a hack to get the include files linked correctly.  We would
 #  LOVE to be able to do:
 #
-#      $${libfreeradius-${2}.la_OBJS}: | src/include/${2}
+#      $${libfreeradius-${1}.la_OBJS}: | src/include/${1}
 #
 #  but GNU Make is too stupid to wait until that variable is defined
 #  to evaluate the condition.  Instead, it evaluates the rule
@@ -15,19 +15,24 @@ define LIB_INCLUDE
 #  So, we instead depend on a targe which has already been defined.t
 #  - This is a terrible hack
 #
-src/freeradius-devel: | src/include/${2}
+src/freeradius-devel: | src/include/${1}
 
-src/include/${2}:
-       $${Q}[ -e $$@ ] || ln -sf $${top_srcdir}/src/${1}/${2} $$@
-       @echo LN-SF src/lib/${2} $$@
+src/include/${1}:
+       $${Q}[ -e $$@ ] || ln -sf $${top_srcdir}/src/lib/${1} $$@
+       @echo LN-SF src/lib/${1} $$@
 
-ifeq "${1}" "lib"
-install.src.include: $(addprefix ${SRC_INCLUDE_DIR}/,src/${1}/${2}/base.h)
-else
-install.src.include: $(addprefix ${SRC_INCLUDE_DIR}/,src/${1}/${1}.h)
-endif
+install.src.include: $(addprefix ${SRC_INCLUDE_DIR}/,${1}/base.h)
 endef
 
+define PROTO_INCLUDE
+src/freeradius-devel: | src/include/${1}
+
+src/include/${1}:
+       $${Q}[ -e $$@ ] || ln -sf $${top_srcdir}/src/protocols/${1} $$@
+       @echo LN-SF src/lib/${1} $$@
+
+install.src.include: $(addprefix ${SRC_INCLUDE_DIR}/${1}/,$(notdir $(wildcard src/protocols/${1}/*.h)))
+endef
 
 #
 #  All lib go into subdirectories of the "lib" directory.
@@ -38,7 +43,7 @@ SUBMAKEFILES := $(wildcard ${top_srcdir}/src/lib/*/all.mk)
 #  Add library-specific rules to link include files, etc.
 #
 $(foreach x,$(SUBMAKEFILES), \
-       $(eval $(call LIB_INCLUDE,lib,$(subst /all.mk,,$(subst ${top_srcdir}/src/lib/,,$x)))) \
+       $(eval $(call LIB_INCLUDE,$(subst /all.mk,,$(subst ${top_srcdir}/src/lib/,,$x)))) \
 )
 
 
@@ -46,5 +51,5 @@ $(foreach x,$(SUBMAKEFILES), \
 #  Add protocol-specific rules to link include files, etc.
 #
 $(foreach x,$(wildcard ${top_srcdir}/src/protocols/*/all.mk), \
-       $(eval $(call LIB_INCLUDE,protocols,$(subst /all.mk,,$(subst ${top_srcdir}/src/protocols/,,$x)))) \
+       $(eval $(call PROTO_INCLUDE,$(subst /all.mk,,$(subst ${top_srcdir}/src/protocols/,,$x)))) \
 )