[En-Nut-Discussion] Allow to specify dependancies

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Jul 3 16:16:15 CEST 2012


>>>>> "Harald" == Harald Kipp <harald.kipp at egnite.de> writes:

    Harald> Hi Uwe, I'm not sure whether it is a good idea to respond to
    Harald> this without investing much more time to look into the
    Harald> details. True to the open source motto "release early, release
    Harald> often", I'll add my 2 cents.

...
    Harald> Also note, that the GNU preprocessor is able to create
    Harald> dependency files. Makerules.gcc already contains

    Harald> %.dep: %.c $(CC) -MM $(CPPFLAGS) $(CFLAGS) -o $@ $<

You are right, automatic generation is the right thing. Could people please
test appended changes to nut/Makerules.gcc. It worked for me for the
stm_usart<x>.c and the os/nutinit.c case.

Harald, can you revert my patch
------------------------------------------------------------------------
r4326 | u_bonnes | 2012-07-03 11:59:33 +0200 (Di, 03. Jul 2012) | 2 Zeilen

Allow to specify dependancies

Or should I do another commit, reverting r4326?

Bye

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
diff --git a/nut/Makerules.gcc b/nut/Makerules.gcc
index ea74254..f9532d3 100644
--- a/nut/Makerules.gcc
+++ b/nut/Makerules.gcc
@@ -36,10 +36,7 @@
 #
 
 include $(top_srcdir)/Makerules.all
-
-%.dep: %.c
-	@echo "  [CC] $<"
-	@$(CC) -MM $(CPPFLAGS) $(CFLAGS) -o $@ $<
+CPPFLAGS += -MD -MP
 
 %.o : %.c
 	@echo "  [CC] $<"
@@ -63,9 +60,8 @@ include $(top_srcdir)/Makerules.all
 $(PROJ).a: $(OBJS)
 
 cleancc:
-	-rm -f $(OBJS) $(DEPS)
+	-rm -f $(OBJS) $(SRCS:%.c=%.d) $(OBJ1:.o=.d)
 	-rm -f $(OBJS:.o=.lst) $(OBJ1:.o=.lst) $(OBJ2:.o=.lst) $(OBJ3:.o=.lst) $(OBJ4:.o=.lst) $(OBJ5:.o=.lst)
 
-ifdef DEPS
--include $(DEPS)
-endif
+# http://www.microhowto.info/howto/automatically_generate_makefile_dependencies.html
+-include $(SRCS:%.c=%.d)



More information about the En-Nut-Discussion mailing list