r5850 - trunk/eda/fped

werner at docs.openmoko.org werner at docs.openmoko.org
Sat Feb 20 06:10:24 CET 2010


Author: werner
Date: 2010-02-20 06:10:24 +0100 (Sat, 20 Feb 2010)
New Revision: 5850

Modified:
   trunk/eda/fped/Makefile
Log:
Generating full dependencies for each and every change slowed down development
quite a bit. We now use per-file granularity for dependencies, reducing the
overhead by about a factor of 30.

- Makefile: generate per-file dependencies (.d) when compiling, based on
  http://scottmcpeak.com/autodepend/autodepend.html
- Makefile: "depend" target is no longer used



Modified: trunk/eda/fped/Makefile
===================================================================
--- trunk/eda/fped/Makefile	2010-02-19 22:27:25 UTC (rev 5849)
+++ trunk/eda/fped/Makefile	2010-02-20 05:10:24 UTC (rev 5850)
@@ -57,15 +57,13 @@
 CC_normal	:= $(CC)
 YACC_normal	:= $(YACC)
 LEX_normal	:= $(LEX)
-DEPEND_normal = \
-  $(CPP) $(CFLAGS) -MM -MG *.c >.depend || \
-  { rm -f .depend; exit 1; }
+DEPEND_normal	:= $(CPP) $(CFLAGS) -MM -MG
 
 CC_quiet	= @echo "  CC       " $@ && $(CC_normal)
 YACC_quiet	= @echo "  YACC     " $@ && $(YACC_normal)
 LEX_quiet	= @echo "  LEX      " $@ && $(LEX_normal)
 GEN_quiet	= @echo "  GENERATE " $@ &&
-DEPEND_quiet	= @echo "  DEPENDENCIES" && $(DEPEND_normal)
+DEPEND_quiet	= @$(DEPEND_normal)
 
 ifeq ($(V),1)
     CC		= $(CC_normal)
@@ -88,6 +86,17 @@
 
 .SUFFIXES:	.fig .xpm .ppm
 
+# compile and generate dependencies, based on
+# http://scottmcpeak.com/autodepend/autodepend.html
+
+%.o:		%.c
+		$(CC) -c $(CFLAGS) $*.c -o $*.o
+		$(DEPEND) $(CFLAGS) $*.c | \
+		  sed -e \
+		    '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/  */:\n/g;H;}' \
+		    -e '$${g;p;}' -e d >$*.d; \
+		  [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
+		
 # generate 26x26 pixels icons, then drop the 1-pixel frame
 
 .fig.ppm:
@@ -142,16 +151,16 @@
 
 # ----- Dependencies ----------------------------------------------------------
 
-dep depend .depend: lex.yy.c y.tab.h y.tab.c *.h *.c
-		$(DEPEND)
+dep depend .depend:
+		@echo 'no need to run "make depend" anymore' 1>&2
 
--include .depend
+-include $(OBJS:.o=.d)
 
 # ----- Cleanup ---------------------------------------------------------------
 
 clean:
 		rm -f $(OBJS) $(XPMS:%=icons/%) $(XPMS:%.xpm=icons/%.ppm)
-		rm -f lex.yy.c y.tab.c y.tab.h y.output .depend
+		rm -f lex.yy.c y.tab.c y.tab.h y.output .depend $(OBJS:.o=.d)
 		rm -f __dbg????.png _tmp*
 
 # ----- Install / uninstall ---------------------------------------------------




More information about the commitlog mailing list