]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
GNU Make rules to automatically run radict
authorAlan T. DeKok <aland@freeradius.org>
Tue, 13 Jan 2026 02:14:14 +0000 (21:14 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 13 Jan 2026 16:36:59 +0000 (11:36 -0500)
and build the various "dict to C" and "dict to header file"
outputs

src/protocols/all.mk

index da59dd055fafebcaa267b17e835a2f732bc334de..f8cb8d79c0797bccfe5d8336deffea9a5b5ad074 100644 (file)
@@ -1,3 +1,45 @@
+#
+#  $(eval $(call DICT_STATS,radius,auth_serv,mib-2.radiusAuthServ,1.3.6.1.2.1.67.1.1.1.1))
+#
+#  We don't want the outputs to be updated if the build fails.  So we use an intermediate filename.
+#  And we use ".cache", because that's ignored by the top level ".gitignore"
+#
+define DICT_STATS
+#
+#  Define the structures and declare the extern variables
+#
+src/protocols/${1}/stats/${2}_stats.h: share/dictionary/${1}/dictionary.stats $(BUILD_DIR)/bin/local/radict$(E)
+       @echo STATS ${1} ${2} - structs
+       ${Q}./scripts/bin/radict -F stats.h -M ${4} -p ${1} ${3} > $$@.cache && mv $$@.cache $$@
+
+#
+#  define the "attr_foo" definitions for the dictionary autoload to populate
+#
+src/protocols/${1}/stats/${2}_da_def.c: share/dictionary/${1}/dictionary.stats $(BUILD_DIR)/bin/local/radict$(E)
+       @echo STATS ${1} ${2} - define variables
+       ${Q}./scripts/bin/radict -F da_def -M ${4} -p ${1} ${3} > $$@.cache && mv $$@.cache $$@
+
+#
+#  define the autoload structures which point to the "attr_foo" defintions
+#
+src/protocols/${1}/stats/${2}_da_autoload.c: share/dictionary/${1}/dictionary.stats $(BUILD_DIR)/bin/local/radict$(E)
+       @echo STATS ${1} ${2} - autoload
+       ${Q}./scripts/bin/radict -F attr_autoload -M ${4} -p ${1} ${3} > $$@.cache && mv $$@.cache $$@
+
+#
+#  define the linking structure between the statistics structure and the DAs.
+#
+src/protocols/${1}/stats/${2}_stats.c: share/dictionary/${1}/dictionary.stats $(BUILD_DIR)/bin/local/radict$(E)
+       @echo STATS ${1} ${2} - link
+       ${Q}./scripts/bin/radict -F stats_link -M ${4} -p ${1} ${3} > $$@.cache && mv $$@.cache $$@
+
+#
+#  The output OBJ has to be rebuilt if any of the input files have changed.
+#
+$(BUILD_DIR)/objs/src/protocols/${1}/stats/base.${OBJ_EXT}: src/protocols/${1}/stats/${2}_stats.h src/protocols/${1}/stats/${2}_da_def.c src/protocols/${1}/stats/${2}_da_autoload.c src/protocols/${1}/stats/${2}_stats.c
+
+endef
+
 #
 #  All protocols go into subdirectories of the "protocols" directory.
 #