shithub: scc

Download patch

ref: 81c72588ffc4ab7139aca57d2a0121c263f99af2
parent: 58149ef559f52ec3e1604513f15c776f59065eca
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Nov 2 04:38:18 EDT 2013

Fix generation of makefile dependencies

--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,6 @@
 
 OBJS = types.o decl.o lex.o error.o symbol.o flow.o main.o expr.o \
 	wrapper.o tree.o
-LIBS =
 
 all: kcc
 
@@ -8,16 +7,14 @@
 kcc: $(OBJS)
 	$(CC) $(LDFLAGS) $(CFLAGS) $(LIBS) $(OBJS) -o $@
 
-%.d: %.c
-	$(CC) -M $(CPPFLAGS) $< | \
-	sed -e 's,/usr/[^ ]*,,g' | \
-	egrep -v '^ *\\$$' > $@
-
 .PHONY: clean distclean dep
 
-dep: $(OBJS:.o=.d)
-	cat Makefile $? > makefile
-	rm -f *.d
+dep:
+	(cat Makefile; \
+	for i in $(OBJS:.o=.c); \
+	do \
+		$(CC) -MM $(CPPFLAGS) $$i; \
+	done) > makefile
 
 clean:
 	rm -f $(OBJS)
@@ -25,9 +22,8 @@
 
 distclean: clean
 	rm -f *~
-	rm -f *.d
+	rm -f tags
+	rm -f cscope.*
 	rm -f makefile
-
-
 
 ###Dependencies