From: Alan T. DeKok Date: Thu, 1 Jan 2026 16:08:40 +0000 (-0500) Subject: simplify the build rules X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2a049c0f4d1315254ace3a18d0ddc4bdf8b01ac;p=thirdparty%2Ffreeradius-server.git simplify the build rules 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. --- diff --git a/scripts/build/make/common.mk b/scripts/build/make/common.mk new file mode 100644 index 0000000000..5f90b36ce1 --- /dev/null +++ b/scripts/build/make/common.mk @@ -0,0 +1,20 @@ +# +# 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} diff --git a/scripts/build/make/dlopen.mk b/scripts/build/make/dlopen.mk index 41c51b15e2..b32ba368d5 100644 --- a/scripts/build/make/dlopen.mk +++ b/scripts/build/make/dlopen.mk @@ -1,31 +1,3 @@ -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 diff --git a/scripts/build/make/util.mk b/scripts/build/make/util.mk index 1b43a23d19..958b014c7c 100644 --- a/scripts/build/make/util.mk +++ b/scripts/build/make/util.mk @@ -1,31 +1,3 @@ -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 diff --git a/scripts/build/make/version.mk b/scripts/build/make/version.mk index e3e20cb7c9..9586fd38e4 100644 --- a/scripts/build/make/version.mk +++ b/scripts/build/make/version.mk @@ -1,31 +1,3 @@ -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