aboutsummaryrefslogtreecommitdiff
path: root/arduino-mk/Arduino.mk
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2013-02-20 17:30:44 +0100
committerMatthijs Kooijman <matthijs@stdin.nl>2013-05-30 21:22:54 +0200
commit4ea3ab78849820e4b32b573baf6bb3f8743c20dd (patch)
tree99f37d38adbd49181632c382e2d7ad3189b7818d /arduino-mk/Arduino.mk
parentb96e03dde1a47e6f6a61808724fd3abf0eb28c39 (diff)
Enable dependency tracking for libraries and core
This makes sure a library or core file gets rebuild when a header file it depends on is changed, preventing weird surprises when the application is recompiled with the new header values but the library isn't. For most users, this won't be strictly needed, but anyone working on a library or even the Arduino core, this is must to prevent surprises or needing a make clean between every build attempt.
Diffstat (limited to 'arduino-mk/Arduino.mk')
-rw-r--r--arduino-mk/Arduino.mk18
1 files changed, 9 insertions, 9 deletions
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 01a3df1..148e6b6 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -623,9 +623,6 @@ LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o) $(LOCAL_CPP_SRCS:.cpp=.o) \
$(LOCAL_INO_SRCS:.ino=.o) $(LOCAL_AS_SRCS:.S=.o)
LOCAL_OBJS = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
-# Dependency files
-DEPS = $(LOCAL_OBJS:.o=.d)
-
ifneq ($(words $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS)), 1)
$(error Need exactly one .pde or .ino file)
endif
@@ -751,6 +748,9 @@ LIB_OBJS = $(patsubst $(ARDUINO_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(LIB_C_SR
USER_LIB_OBJS = $(patsubst $(USER_LIB_PATH)/%.cpp,$(OBJDIR)/libs/%.o,$(USER_LIB_CPP_SRCS)) \
$(patsubst $(USER_LIB_PATH)/%.c,$(OBJDIR)/libs/%.o,$(USER_LIB_C_SRCS))
+# Dependency files
+DEPS = $(LOCAL_OBJS:.o=.d) $(LIB_OBJS:.o=.d) $(USER_LIB_OBJS:.o=.d) $(CORE_OBJS:.o=.d)
+
# Using += instead of =, so that CPPFLAGS can be set per sketch level
CPPFLAGS += -mmcu=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) \
-I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \
@@ -806,16 +806,16 @@ $(call show_separator)
# library sources
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.c | $(OBJDIR)
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
+ $(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
$(OBJDIR)/libs/%.o: $(ARDUINO_LIB_PATH)/%.cpp | $(OBJDIR)
- $(CC) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+ $(CC) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.cpp | $(OBJDIR)
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
+ $(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
$(OBJDIR)/libs/%.o: $(USER_LIB_PATH)/%.c | $(OBJDIR)
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
+ $(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
# normal local sources
COMMON_DEPS := Makefile
@@ -851,10 +851,10 @@ $(OBJDIR)/%.s: $(OBJDIR)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
# core files
$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) | $(OBJDIR)
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
+ $(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
$(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
- $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+ $(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
# various object conversions
$(OBJDIR)/%.hex: $(OBJDIR)/%.elf $(COMMON_DEPS)