summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2012-08-14 21:36:11 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2012-08-14 21:36:11 +0000
commitf3b8d9d632adf293fd7bda64dbbb5c51f81bb2c3 (patch)
tree95f7b96689c8d85c12a53fbd40a739a496a3f020 /Makefile
parentb9de3ee1035a93c7e00af4e10858996c09648f1a (diff)
downloadflashrom-f3b8d9d632adf293fd7bda64dbbb5c51f81bb2c3.tar.gz
Allow the user to specify CFLAGS without breaking the build
GNU make has a very interesting quirk: If you set a variable on the command line, any changes to that variable in the Makefile are ignored unless marked with the "override" keyword. Use CFLAGS only for optimization and warning options, and use CPPFLAGS for the dependency and other preprocessor related options. That way packagers can specify their own CFLAGS without breaking the build. As a side benefit, the ich_descriptors_tool Makefile now behaves exactly the same whether called standalone or as part of the main Makefile. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1574 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 5 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 774d5b3..c78f419 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,9 @@ PROGRAM = flashrom
# If you want to cross-compile, just run e.g.
# make CC=i586-pc-msdosdjgpp-gcc
# You may have to specify STRIP/AR/RANLIB as well.
+#
+# Note for anyone editing this Makefile: gnumake will happily ignore any
+# changes in this Makefile to variables set on the command line.
CC ?= gcc
STRIP ?= strip
INSTALL = install
@@ -83,7 +86,7 @@ ifeq ($(TARGET_OS), DOS)
EXEC_SUFFIX := .exe
CPPFLAGS += -I../libgetopt
# DJGPP has odd uint*_t definitions which cause lots of format string warnings.
-CPPFLAGS += -Wno-format
+CFLAGS += -Wno-format
# FIXME Check if we can achieve the same effect with -L../libgetopt -lgetopt
LIBS += ../libgetopt/libgetopt.a
# Bus Pirate, Serprog and PonyProg are not supported under DOS (missing serial support).
@@ -119,7 +122,7 @@ endif
ifeq ($(TARGET_OS), MinGW)
EXEC_SUFFIX := .exe
# MinGW doesn't have the ffs() function, but we can use gcc's __builtin_ffs().
-CFLAGS += -Dffs=__builtin_ffs
+CPPFLAGS += -Dffs=__builtin_ffs
# libusb-win32/libftdi stuff is usually installed in /usr/local.
CPPFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib