aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2009-05-09 18:09:02 +0000
committerDavid A. Mellis <d.mellis@arduino.cc>2009-05-09 18:09:02 +0000
commit33fd8b8631bd8d5cd609935a2dd2fbb31688f2c1 (patch)
tree070bd444efa775b4720ca243938f64d8330dcd63 /cores/arduino
parent5489db7185fd6175bfb7cc51b21dc9448c386066 (diff)
Modifying Makefile to generate dependencies (and .d files) automatically. Patch from Lars Immisch: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1241007184
Diffstat (limited to 'cores/arduino')
-rwxr-xr-xcores/arduino/Makefile27
1 files changed, 13 insertions, 14 deletions
diff --git a/cores/arduino/Makefile b/cores/arduino/Makefile
index f01902b..30ea655 100755
--- a/cores/arduino/Makefile
+++ b/cores/arduino/Makefile
@@ -1,4 +1,4 @@
-# Arduino 0011 Makefile
+# Arduino 0015 Makefile
# Arduino adaptation by mellis, eighthave, oli.keller
#
# This makefile allows you to build sketches from the command line
@@ -35,7 +35,7 @@
# $Id$
TARGET = $(notdir $(CURDIR))
-INSTALL_DIR = /Users/dmellis/Source/arduino/trunk/build/macosx/build/work
+INSTALL_DIR = ../../..
PORT = /dev/tty.usb*
UPLOAD_RATE = 19200
AVRDUDE_PROGRAMMER = stk500v1
@@ -223,6 +223,13 @@ applet/core.a: $(OBJ)
$(CC) -c $(ALL_ASFLAGS) $< -o $@
+# Automatic dependencies
+%.d: %.c
+ $(CC) -M $(ALL_CFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
+
+%.d: %.cpp
+ $(CXX) -M $(ALL_CXXFLAGS) $< | sed "s;$(notdir $*).o:;$*.o $*.d:;" > $@
+
# Target: clean project.
clean:
@@ -230,15 +237,7 @@ clean:
applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/core.a \
$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
-depend:
- if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \
- then \
- sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \
- $(MAKEFILE).$$$$ && \
- $(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \
- fi
- echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \
- >> $(MAKEFILE); \
- $(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE)
-
-.PHONY: all build elf hex eep lss sym program coff extcoff clean depend applet_files sizebefore sizeafter
+.PHONY: all build elf hex eep lss sym program coff extcoff clean applet_files sizebefore sizeafter
+
+include $(SRC:.c=.d)
+include $(CXXSRC:.cpp=.d)