[mw-devel] MW3 r1064 - trunk/src

welshbyte at sucs.org welshbyte at sucs.org
Wed Mar 11 20:11:04 GMT 2009


Author: welshbyte
Date: 2009-03-11 20:11:04 +0000 (Wed, 11 Mar 2009)
New Revision: 1064

Modified:
   trunk/src/Makefile
Log:
Fix auto dependency generation.


Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2009-01-15 14:56:53 UTC (rev 1063)
+++ trunk/src/Makefile	2009-03-11 20:11:04 UTC (rev 1064)
@@ -21,10 +21,10 @@
 
 # Name of the js library (differs between distros)
 JSLIB=$(shell if `echo "main(){}" | gcc -x c -ljs - 2> /dev/null`; then echo js; else echo mozjs; fi; rm -f a.out)
-CPPFLAGS+=-I/usr/include/mozjs
+CFLAGS+=-I/usr/include/mozjs
 
 # cflags for standard 'cc' compiler
-ALL_CFLAGS+= -Wall -pedantic -fpie -std=gnu99 -D_GNU_SOURCE
+CFLAGS+= -Wall -pedantic -fpie -std=gnu99 -D_GNU_SOURCE
 LDFLAGS+= -pie
 LDLIBS+= -lreadline -lhistory -ltermcap -lcrypt -l$(JSLIB) -lsqlite3 -lcurl
 
@@ -44,10 +44,10 @@
 
 ### uncomment for gdb debugging
 LDFLAGS+= -ggdb -g
-ALL_CFLAGS+= -ggdb -g -D__NO_STRING_INLINE
+CFLAGS+= -ggdb -g -D__NO_STRING_INLINE
 
 ### Optimisation - uncomment for release & extra testing
-ALL_CFLAGS+=-O4
+CFLAGS+=-O4
 
 ### Only ever uncomment for final release versions
 DEFS+= -DRELEASE
@@ -55,21 +55,23 @@
 ### Uncomment for release candidates that all users should be able to run
 #DEFS+= -DPUBLIC
 
-ALL_CFLAGS += $(DEFS)
+CFLAGS += $(DEFS)
 
-all: mw red
+### The magic which lets us autogenerate dependencies
+CFLAGS += -MMD
 
 CODE=$(wildcard *.c)
 HDRS=$(wildcard *.h)
 
-%.d: %.c
-	$(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'
+%.o: %.c
+	$(CC) $(CFLAGS) -c -o $@ $<
 	
 -include $(CODE:.c=.d)
 
 .PHONY: all install clean wipe
 
+all: mw red
+
 messages.po: $(CODE) $(HDRS)
 	xgettext --copyright-holder="Justin Mitchell <arthur at sucs.org>" -E  --no-wrap --keyword=_ $^ -j -o messages.po 
 





More information about the mw-devel mailing list