1 # This Makefile fragment (since dpkg 1.16.1) defines the following host
4 # ASFLAGS: flags for the host assembler (since 1.21.0).
5 # CFLAGS: flags for the host C compiler.
6 # CPPFLAGS: flags for the host C preprocessor.
7 # CXXFLAGS: flags for the host C++ compiler.
8 # OBJCFLAGS: flags for the host Objective C compiler.
9 # OBJCXXFLAGS: flags for the host Objective C++ compiler.
10 # DFLAGS: flags for the host D compiler.
11 # FFLAGS: flags for the host Fortran 77 compiler.
12 # FCFLAGS: flags for the host Fortran 9x compiler.
13 # LDFLAGS: flags for the host linker.
15 # And the following variables for the build tools (since dpkg 1.22.1):
17 # ASFLAGS_FOR_BUILD: flags for the build assembler.
18 # CFLAGS_FOR_BUILD: flags for the build C compiler.
19 # CPPFLAGS_FOR_BUILD: flags for the build C preprocessor.
20 # CXXFLAGS_FOR_BUILD: flags for the build C++ compiler.
21 # OBJCFLAGS_FOR_BUILD: flags for the build Objective C compiler.
22 # OBJCXXFLAGS_FOR_BUILD: flags for the build Objective C++ compiler.
23 # DFLAGS_FOR_BUILD: flags for the build D compiler.
24 # FFLAGS_FOR_BUILD: flags for the build Fortran 77 compiler.
25 # FCFLAGS_FOR_BUILD: flags for the build Fortran 9x compiler.
26 # LDFLAGS_FOR_BUILD: flags for the build linker.
28 # You can also export them in the environment by setting
29 # DPKG_EXPORT_BUILDFLAGS to a non-empty value.
32 # - Only documented variables are considered public interfaces.
33 # - Expects to be included from the source tree root directory.
35 ifndef dpkg_buildflags_mk_included
36 dpkg_buildflags_mk_included
= yes
38 # This list is kept in sync with the default set of flags returned
41 dpkg_lazy_eval ?
= $$(or
$$(value DPKG_CACHE_
$(1)),$$(eval DPKG_CACHE_
$(1) := $$(shell $(2)))$$(value DPKG_CACHE_
$(1)))
43 DPKG_BUILDFLAGS_LIST
:= $(foreach var
,\
54 ,$(var
) $(var
)_FOR_BUILD
)
56 define dpkg_buildflags_export_envvar
58 DPKG_BUILDFLAGS_EXPORT_ENVVAR
+= $(1)="$$(value $(1))"
62 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_BUILD_OPTIONS
))
63 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_BUILD_MAINT_OPTIONS
))
64 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_BUILD_PATH
))
65 $(foreach flag
,$(DPKG_BUILDFLAGS_LIST
),\
66 $(foreach operation
,SET STRIP APPEND PREPEND
,\
67 $(eval
$(call dpkg_buildflags_export_envvar
,DEB_
$(flag
)_MAINT_
$(operation
)))))
69 dpkg_buildflags_setvar
= $(1) = $(call dpkg_lazy_eval
,$(1),$(DPKG_BUILDFLAGS_EXPORT_ENVVAR
) dpkg-buildflags
--get $(1))
71 $(foreach flag
,$(DPKG_BUILDFLAGS_LIST
),\
72 $(eval
$(call dpkg_buildflags_setvar
,$(flag
))))
74 ifdef DPKG_EXPORT_BUILDFLAGS
75 export $(DPKG_BUILDFLAGS_LIST
)
78 endif # dpkg_buildflags_mk_included