remove unnecessary comments and examples.
move common definitions to a common.mk file
simplify the use of $(filter-out ...)
filter out "--rtlib=.." from the LDFLAGS. This change prevents
linking errors when building with the sanitizers enabled.
--- /dev/null
+#
+# All of the files in this directory produce GNU make log messages,
+# and not FreeRADIUS log messages,
+#
+TARGET := libfreeradius-make-${TARGET_NAME}.$(BUILD_LIB_EXT)
+SOURCES := ${TARGET_NAME}.c log.c
+
+#
+# This target is NOT built with static analyzer flags.
+#
+$(TARGET): CFLAGS := $(filter-out -W% -fsanitize%,$(CFLAGS))
+$(TARGET): CPPFLAGS := $(filter-out -W%,$(CPPFLAGS))
+$(TARGET): LDFLAGS := $(filter-out -fsanitize% --rtlib=%,$(LDFLAGS))
+
+#
+# This gets built with the BUILD_CC i.e. the one we use to bootstrap
+# this build system.
+#
+SRC_CC := ${HOST_COMPILE.c}
+TGT_LINKER := ${HOST_LINK.c}
-TARGET := libfreeradius-make-dlopen.$(BUILD_LIB_EXT)
-SOURCES := dlopen.c log.c
+TARGET_NAME := dlopen
-#
-# This target is NOT built with static analyzer flags.
-#
-$(TARGET): CFLAGS := $(filter-out -W%,$(filter-out -fsanitize%,$(CFLAGS)))
-$(TARGET): CPPFLAGS := $(filter-out -W%,$(CPPFLAGS))
-$(TARGET): LDFLAGS := $(filter-out -fsanitize%,$(LDFLAGS))
-
-#
-# This gets built with the BUILD_CC i.e. the one we use to bootstrap
-# this build system.
-#
-SRC_CC := ${HOST_COMPILE.c}
-TGT_LINKER := ${HOST_LINK.c}
-
-#
-# If we're building this target, then don't try to use it until we know
-# that building the target succeeds.
-#
-#ifneq "$(MAKECMDGOALS)" "$(TARGET)"
-#load ${BUILD_DIR}/lib/.libs/libfreeradius-make-dlopen.$(BUILD_LIB_EXT)(dlopen_gmk_setup)
-
-#$(info $(dlopen /home/foo/libcrypto,ASN1_verify,/home/user,/foo,/usr/local/Cellar/openssl@1.1/1.1.1d/lib))
-#$(info $(dlsym libcrypto,ASN1_verify))
-#$(info $(dlclose libcrypto))
-
-#$(info $(dlopen libfoobar))
-#$(info $(dlerror ))
-#endif
+include ${top_srcdir}/scripts/build/make/common.mk
-TARGET := libfreeradius-make-util.$(BUILD_LIB_EXT)
-SOURCES := util.c log.c
+TARGET_NAME := util
-#
-# This target is NOT built with static analyzer flags.
-#
-$(TARGET): CFLAGS := $(filter-out -W%,$(filter-out -fsanitize%,$(CFLAGS)))
-$(TARGET): CPPFLAGS := $(filter-out -W%,$(CPPFLAGS))
-$(TARGET): LDFLAGS := $(filter-out -fsanitize%,$(LDFLAGS))
-
-#
-# This gets built with the BUILD_CC i.e. the one we use to bootstrap
-# this build system.
-#
-SRC_CC := ${HOST_COMPILE.c}
-TGT_LINKER := ${HOST_LINK.c}
-
-#
-# If we're building this target, then don't try to use it until we know
-# that building the target succeeds.
-#
-#ifneq "$(MAKECMDGOALS)" "$(TARGET)"
-#load ${BUILD_DIR}/lib/.libs/libfreeradius-make-util.$(BUILD_LIB_EXT)(util_gmk_setup)
-
-#$(info $(dlopen /home/foo/libcrypto,ASN1_verify,/home/user,/foo,/usr/local/Cellar/openssl@1.1/1.1.1d/lib))
-#$(info $(dlsym libcrypto,ASN1_verify))
-#$(info $(dlclose libcrypto))
-
-#$(info $(dlopen libfoobar))
-#$(info $(dlerror ))
-#endif
+include ${top_srcdir}/scripts/build/make/common.mk
-TARGET := libfreeradius-make-version.$(BUILD_LIB_EXT)
-SOURCES := version.c log.c
+TARGET_NAME := version
-#
-# This target is NOT built with static analyzer flags.
-#
-$(TARGET): CFLAGS := $(filter-out -W%,$(filter-out -fsanitize%,$(CFLAGS)))
-$(TARGET): CPPFLAGS := $(filter-out -W%,$(CPPFLAGS))
-$(TARGET): LDFLAGS := $(filter-out -fsanitize%,$(LDFLAGS))
-
-#
-# This gets built with the BUILD_CC i.e. the one we use to bootstrap
-# this build system.
-#
-SRC_CC := ${HOST_COMPILE.c}
-TGT_LINKER := ${HOST_LINK.c}
-
-#
-# If we're building this target, then don't try to use it until we know
-# that building the target succeeds.
-#
-#ifneq "$(MAKECMDGOALS)" "$(TARGET)"
-#load ${BUILD_DIR}/lib/.libs/libfreeradius-make-version.$(BUILD_LIB_EXT)(version_gmk_setup)
-
-#$(info $(dlopen /home/foo/libcrypto,ASN1_verify,/home/user,/foo,/usr/local/Cellar/openssl@1.1/1.1.1d/lib))
-#$(info $(dlsym libcrypto,ASN1_verify))
-#$(info $(dlclose libcrypto))
-
-#$(info $(dlopen libfoobar))
-#$(info $(dlerror ))
-#endif
+include ${top_srcdir}/scripts/build/make/common.mk