1 # This Makefile fragment (since dpkg 1.16.1) defines the following variables:
3 # ASFLAGS: flags for the assembler (since 1.21.0).
4 # CFLAGS: flags for the C compiler.
5 # CPPFLAGS: flags for the C preprocessor.
6 # CXXFLAGS: flags for the C++ compiler.
7 # OBJCFLAGS: flags for the Objective C compiler.
8 # OBJCXXFLAGS: flags for the Objective C++ compiler.
9 # GCJFLAGS: flags for the GNU Java compiler.
10 # DFLAGS: flags for the D compiler.
11 # FFLAGS: flags for the Fortran 77 compiler.
12 # FCFLAGS: flags for the Fortran 9x compiler.
13 # LDFLAGS: flags for the linker.
15 # You can also export them in the environment by setting
16 # DPKG_EXPORT_BUILDFLAGS to a non-empty value.
18 # This list is kept in sync with the default set of flags returned
21 dpkg_lazy_eval ?
= $$(or
$$(value DPKG_CACHE_
$(1)),$$(eval DPKG_CACHE_
$(1) := $$(shell $(2)))$$(value DPKG_CACHE_
$(1)))
23 DPKG_BUILDFLAGS_LIST
= ASFLAGS CFLAGS CPPFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS \
24 GCJFLAGS DFLAGS FFLAGS FCFLAGS LDFLAGS
26 define dpkg_buildflags_export_envvar
28 DPKG_BUILDFLAGS_EXPORT_ENVVAR
+= $(1)="$$(value $(1))"
32 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_BUILD_OPTIONS
))
33 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_BUILD_MAINT_OPTIONS
))
34 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_BUILD_PATH
))
35 $(foreach flag
,$(DPKG_BUILDFLAGS_LIST
),\
36 $(foreach operation
,SET STRIP APPEND PREPEND
,\
37 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_
$(flag
)_MAINT_
$(operation
)))))
39 dpkg_buildflags_setvar
= $(1) = $(call dpkg_lazy_eval
,$(1),$(DPKG_BUILDFLAGS_EXPORT_ENVVAR
) dpkg-buildflags
--get $(1))
41 $(foreach flag
,$(DPKG_BUILDFLAGS_LIST
),\
42 $(eval
$(call dpkg_buildflags_setvar
,$(flag
))))
44 ifdef DPKG_EXPORT_BUILDFLAGS
45 export $(DPKG_BUILDFLAGS_LIST
)