]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
new ADD_INSTALL_RULE.h
authorAlan T. DeKok <aland@freeradius.org>
Fri, 17 Aug 2018 15:35:24 +0000 (11:35 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 17 Aug 2018 16:27:18 +0000 (12:27 -0400)
for installing header files

scripts/install.mk

index 9142201e39a27ade620dc50c069eff35dc761853..a42b0e7365fe6597b3896f766040c46f74e9ae48 100644 (file)
@@ -114,6 +114,39 @@ define ADD_INSTALL_RULE.man
 endef
 
 
+# ADD_INSTALL_RULE.h - Parameterized "function" that adds a new rule
+#   and phony target for installing a header file.
+#
+#  Note that we re-write the header files to get rid of
+#  "freeradius-devel" and replace it with "freeradius"
+#
+#  install-sh function for creating directories gets confused
+#  if there's a trailing slash, tries to create a directory
+#  it already created, and fails...
+#
+# ${1} = filename where it will be installed
+# ${2} = filename in the source
+#
+#  Because things in .../src/lib/io/foo.h go into .../io/foo.h
+#
+#  For 'sed', the expression must deal with indentation after the hash
+#  and copy it to the substitution string.  The hash is not anchored
+#  in order to allow substitution in function documentation.
+#
+#   USE WITH EVAL
+#
+define ADD_INSTALL_RULE.h
+    ALL_INSTALL += $(DESTDIR)/${includedir}/${1}
+
+    install: $(DESTDIR)/${includedir}/${1}
+
+    $(DESTDIR)/${includedir}/${1}: ${2}
+       ${Q}echo INSTALL $$(notdir $$<)
+       ${Q}$(INSTALL) -d -m 755 `echo $$(dir $$@) | sed 's/\/$$$$//'`
+       ${Q}sed -e 's/#\([\\t ]*\)include <freeradius-devel\/\([^>]*\)>/#\1include <freeradius\/\2>/g' < $$< > $$@
+       ${Q}chmod 644 $$@
+endef
+
 # ADD_INSTALL_RULE.dir - Parameterized "function" that adds a new rule
 #   and phony target for installing a directory
 #
@@ -211,7 +244,7 @@ ifeq "${logdir}" ""
     logdir = ${localstatedir}/log/
 endif
 ifeq "${includedir}" ""
-    includedir = ${prefix}/include/${PROJECT_NAME}
+    includedir = ${prefix}/include/
 endif