diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:45:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:45:20 +0000 |
commit | 9a08cbfcc1ef900a04580f35afe2a4592d7d6030 (patch) | |
tree | 004cc7027bca2f2c0bcb5806527c8e0c48df2d6e /scripts/mk/buildflags.mk | |
parent | Initial commit. (diff) | |
download | dpkg-9a08cbfcc1ef900a04580f35afe2a4592d7d6030.tar.xz dpkg-9a08cbfcc1ef900a04580f35afe2a4592d7d6030.zip |
Adding upstream version 1.19.8.upstream/1.19.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | scripts/mk/buildflags.mk | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/scripts/mk/buildflags.mk b/scripts/mk/buildflags.mk new file mode 100644 index 0000000..bb496e1 --- /dev/null +++ b/scripts/mk/buildflags.mk @@ -0,0 +1,43 @@ +# This Makefile snippet defines the following variables: +# +# CFLAGS: flags for the C compiler +# CPPFLAGS: flags for the C preprocessor +# CXXFLAGS: flags for the C++ compiler +# OBJCFLAGS: flags for the Objective C compiler +# OBJCXXFLAGS: flags for the Objective C++ compiler +# GCJFLAGS: flags for the GNU Java compiler +# FFLAGS: flags for the Fortran 77 compiler +# FCFLAGS: flags for the Fortran 9x compiler +# LDFLAGS: flags for the linker +# +# You can also export them in the environment by setting +# DPKG_EXPORT_BUILDFLAGS to a non-empty value. +# +# This list is kept in sync with the default set of flags returned +# by dpkg-buildflags. + +dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1))) + +DPKG_BUILDFLAGS_LIST = CFLAGS CPPFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS \ + GCJFLAGS FFLAGS FCFLAGS LDFLAGS + +define dpkg_buildflags_export_envvar +ifdef $(1) +DPKG_BUILDFLAGS_EXPORT_ENVVAR += $(1)="$$(value $(1))" +endif +endef + +$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_OPTIONS)) +$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_MAINT_OPTIONS)) +$(foreach flag,$(DPKG_BUILDFLAGS_LIST),\ + $(foreach operation,SET STRIP APPEND PREPEND,\ + $(eval $(call dpkg_buildflags_export_envvar,DEB_$(flag)_MAINT_$(operation))))) + +dpkg_buildflags_setvar = $(1) = $(call dpkg_lazy_eval,$(1),$(DPKG_BUILDFLAGS_EXPORT_ENVVAR) dpkg-buildflags --get $(1)) + +$(foreach flag,$(DPKG_BUILDFLAGS_LIST),\ + $(eval $(call dpkg_buildflags_setvar,$(flag)))) + +ifdef DPKG_EXPORT_BUILDFLAGS + export $(DPKG_BUILDFLAGS_LIST) +endif |