Support setting CFLAGS and CXXFLAGS for libraries/programs

This commit is contained in:
Eelco Dolstra 2014-02-11 14:15:57 +01:00
parent a210c995cd
commit a35c6eb4a2
2 changed files with 10 additions and 2 deletions

View file

@ -17,6 +17,8 @@ endif
# #
# - $(1)_SOURCES: the source files of the library. # - $(1)_SOURCES: the source files of the library.
# #
# - $(1)_CFLAGS: additional C compiler flags.
#
# - $(1)_CXXFLAGS: additional C++ compiler flags. # - $(1)_CXXFLAGS: additional C++ compiler flags.
# #
# - $(1)_LIBS: the symbolic names of other libraries on which this # - $(1)_LIBS: the symbolic names of other libraries on which this
@ -102,7 +104,8 @@ define build-library
$(1)_LDFLAGS_USE += $$($(1)_LDFLAGS_PROPAGATED) $(1)_LDFLAGS_USE += $$($(1)_LDFLAGS_PROPAGATED)
$(1)_LDFLAGS_USE_INSTALLED += $$($(1)_LDFLAGS_PROPAGATED) $(1)_LDFLAGS_USE_INSTALLED += $$($(1)_LDFLAGS_PROPAGATED)
# Propagate CXXFLAGS to the individual object files. # Propagate CFLAGS and CXXFLAGS to the individual object files.
$$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CFLAGS=$$($(1)_CFLAGS)))
$$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS))) $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS)))
# Make each object file depend on the common dependencies. # Make each object file depend on the common dependencies.

View file

@ -8,6 +8,10 @@ programs-list :=
# #
# - $(1)_SOURCES: the source files of the program. # - $(1)_SOURCES: the source files of the program.
# #
# - $(1)_CFLAGS: additional C compiler flags.
#
# - $(1)_CXXFLAGS: additional C++ compiler flags.
#
# - $(1)_LIBS: the symbolic names of libraries on which this program # - $(1)_LIBS: the symbolic names of libraries on which this program
# depends. # depends.
# #
@ -48,7 +52,8 @@ define build-program
endif endif
# Propagate CXXFLAGS to the individual object files. # Propagate CFLAGS and CXXFLAGS to the individual object files.
$$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CFLAGS=$$($(1)_CFLAGS)))
$$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS))) $$(foreach obj, $$($(1)_OBJS), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS)))
# Make each object file depend on the common dependencies. # Make each object file depend on the common dependencies.