[mw-devel] MW3 r1000 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Sat Dec 1 14:19:49 GMT 2007


Author: welshbyte
Date: 2007-12-01 14:19:49 +0000 (Sat, 01 Dec 2007)
New Revision: 1000

Modified:
   trunk/src/Makefile
Log:
Honour user CFLAGS overrides and use ALL_CFLAGS instead


Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2007-12-01 12:18:20 UTC (rev 999)
+++ trunk/src/Makefile	2007-12-01 14:19:49 UTC (rev 1000)
@@ -16,7 +16,7 @@
 JSLIB=js
 
 # cflags for standard 'cc' compiler
-CFLAGS+= -Wall -pedantic -fpie -std=gnu99 -D_GNU_SOURCE
+ALL_CFLAGS+= -Wall -pedantic -fpie -std=gnu99 -D_GNU_SOURCE
 LDFLAGS+= -pie
 LDLIBS+= -lreadline -lhistory -ltermcap -lcrypt -l$(JSLIB) -lsqlite3 -lcurl
 
@@ -33,10 +33,10 @@
 
 ### uncomment for gdb debugging
 LDFLAGS+= -ggdb -g
-CFLAGS+= -ggdb -g -D__NO_STRING_INLINE
+ALL_CFLAGS+= -ggdb -g -D__NO_STRING_INLINE
 
 ### Optimisation - uncomment for release & extra testing
-CFLAGS+=-O4
+ALL_CFLAGS+=-O4
 
 ### Only ever uncomment for final release versions
 DEFS+= -DRELEASE
@@ -44,7 +44,7 @@
 ### Uncomment for release candidates that all users should be able to run
 #DEFS+= -DPUBLIC
 
-CFLAGS += $(DEFS)
+ALL_CFLAGS += $(DEFS)
 
 all: mw red help
 
@@ -52,7 +52,9 @@
 HDRS=$(wildcard *.h)
 
 %.d: %.c
-	$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; [ -s $@ ] || rm -f $@'
+	$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
+	if [ -s $@ ]; then printf '\''\tcc $$(ALL_CFLAGS) $$(CPPFLAGS) -c -o $*.o $<'\'' >> $@ ; else rm -f $@ ; fi'
+	
 -include $(CODE:.c=.d)
 
 .PHONY: all setup_homepath help install clean wipe test





More information about the mw-devel mailing list