[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/64: Support setting CFLAGS and CXXFLAGS for libraries/programs
From: |
Ludovic Courtès |
Subject: |
01/64: Support setting CFLAGS and CXXFLAGS for libraries/programs |
Date: |
Mon, 05 Jan 2015 16:38:47 +0000 |
civodul pushed a commit to branch nix
in repository guix.
commit a35c6eb4a2209716fe1d40cebad2b3adb5d05e0f
Author: Eelco Dolstra <address@hidden>
Date: Tue Feb 11 14:15:57 2014 +0100
Support setting CFLAGS and CXXFLAGS for libraries/programs
---
libraries.mk | 5 ++++-
programs.mk | 7 ++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/libraries.mk b/libraries.mk
index c416947..35ce498 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.
diff --git a/programs.mk b/programs.mk
index ab04ff9..5e27a7d 100644
--- a/programs.mk
+++ b/programs.mk
@@ -8,6 +8,10 @@ programs-list :=
#
# - $(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
# depends.
#
@@ -48,7 +52,8 @@ define build-program
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)))
# Make each object file depend on the common dependencies.
- branch nix updated (0a75126 -> a1dd396), Ludovic Courtès, 2015/01/05
- 01/64: Support setting CFLAGS and CXXFLAGS for libraries/programs,
Ludovic Courtès <=
- 02/64: Add a function for looking up programs in $PATH, Ludovic Courtès, 2015/01/05
- 03/64: More GNU Make 3.81 compatibility, Ludovic Courtès, 2015/01/05
- 06/64: Add a variable GLOBAL_CXXFLAGS_PCH for use by precompiled headers, Ludovic Courtès, 2015/01/05
- 05/64: Add variable GLOBAL_COMMON_DEPS, Ludovic Courtès, 2015/01/05
- 07/64: Add support for making relocatable packages using $ORIGIN, Ludovic Courtès, 2015/01/05
- 09/64: Tweak error message, Ludovic Courtès, 2015/01/05
- 04/64: Make it work on GNU Make > 3.81 again, Ludovic Courtès, 2015/01/05
- 10/64: Support Illumos, Ludovic Courtès, 2015/01/05
- 11/64: Sync with make-rules repo, Ludovic Courtès, 2015/01/05
- 12/64: Fix compile errors on Illumos, Ludovic Courtès, 2015/01/05