about summary refs log tree commit diff
path: root/libraries.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-11T13·15+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-11T13·15+0100
commita35c6eb4a2209716fe1d40cebad2b3adb5d05e0f (patch)
tree655f97028b15c35159587c8badea77259ca2b4f7 /libraries.mk
parenta210c995cdd9279ed4137ec5d2e4cc928cb36097 (diff)
Support setting CFLAGS and CXXFLAGS for libraries/programs
Diffstat (limited to 'libraries.mk')
-rw-r--r--libraries.mk5
1 files changed, 4 insertions, 1 deletions
diff --git a/libraries.mk b/libraries.mk
index c41694794b60..35ce4983a135 100644
--- a/libraries.mk
+++ b/libraries.mk
@@ -17,6 +17,8 @@ endif
 #
 # - $(1)_SOURCES: the source files of the library.
 #
+# - $(1)_CFLAGS: additional C compiler flags.
+#
 # - $(1)_CXXFLAGS: additional C++ compiler flags.
 #
 # - $(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_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)))
 
   # Make each object file depend on the common dependencies.