From: Alan T. DeKok Date: Tue, 13 Jan 2026 02:14:14 +0000 (-0500) Subject: GNU Make rules to automatically run radict X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7cf2ae870b6bf00f877b2482c3c33184b027fc3;p=thirdparty%2Ffreeradius-server.git GNU Make rules to automatically run radict and build the various "dict to C" and "dict to header file" outputs --- diff --git a/src/protocols/all.mk b/src/protocols/all.mk index da59dd055fa..f8cb8d79c07 100644 --- a/src/protocols/all.mk +++ b/src/protocols/all.mk @@ -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. #