Skip to content
Snippets Groups Projects
Commit 23e78d0f authored by DrZiplok's avatar DrZiplok
Browse files

Fix/improve depdendency handling.  Deps are autogenerated on the first compile pass and consumed on subsequent builds.  This helps work around the difficulty of building the 'clean' target with Eclipse.

Don't depend on the build directory anywhere; we automake it as required.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@1368 f9c3cf11-9bcb-44bc-f272-b75c42450872
parent 7bc153f0
No related branches found
No related tags found
No related merge requests found
...@@ -146,15 +146,16 @@ endif ...@@ -146,15 +146,16 @@ endif
# #
DEFINES = -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERS) DEFINES = -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERS)
OPTFLAGS = -Os OPTFLAGS = -Os
DEPFLAGS = -MD -MT $@
# XXX warning options TBD # XXX warning options TBD
CXXOPTS = -mcall-prologues -ffunction-sections -fdata-sections -fno-exceptions CXXOPTS = -mcall-prologues -ffunction-sections -fdata-sections -fno-exceptions
COPTS = -mcall-prologues -ffunction-sections -fdata-sections COPTS = -mcall-prologues -ffunction-sections -fdata-sections
ASOPTS = -assembler-with-cpp ASOPTS = -assembler-with-cpp
CXXFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(CXXOPTS) CXXFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(DEPFLAGS) $(CXXOPTS)
CFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(COPTS) CFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(DEPFLAGS) $(COPTS)
ASFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(ASOPTS) ASFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(DEPFLAGS) $(ASOPTS)
LDFLAGS = -g -mmcu=$(MCU) $(OPTFLAGS) -Wl,--gc-sections LDFLAGS = -g -mmcu=$(MCU) $(OPTFLAGS) -Wl,--gc-sections
LIBS = -lm LIBS = -lm
...@@ -291,6 +292,12 @@ SKETCHEEP = $(BUILDROOT)/$(SKETCH).eep ...@@ -291,6 +292,12 @@ SKETCHEEP = $(BUILDROOT)/$(SKETCH).eep
# The core library # The core library
CORELIB = $(BUILDROOT)/$(HARDWARE)/core.a CORELIB = $(BUILDROOT)/$(HARDWARE)/core.a
# All of the objects that may be built
ALLOBJS = $(SKETCHOBJS) $(LIBOBJS) $(CORELIBOBJS)
# All of the dependency files that may be generated
ALLDEPS = $(ALLOBJS:%.o=%.d)
################################################################################ ################################################################################
# Targets # Targets
# #
...@@ -306,6 +313,9 @@ clean: ...@@ -306,6 +313,9 @@ clean:
# Rules # Rules
# #
# fetch dependency info from a previous build if any of it exists
-include $(ALLDEPS)
# common header for rules, prints what is being built # common header for rules, prints what is being built
define RULEHDR define RULEHDR
@echo %% $(subst $(BUILDROOT)/,,$@) @echo %% $(subst $(BUILDROOT)/,,$@)
...@@ -327,10 +337,6 @@ $(SKETCHEEP): $(SKETCHELF) ...@@ -327,10 +337,6 @@ $(SKETCHEEP): $(SKETCHELF)
$(RULEHDR) $(RULEHDR)
$(v)$(OBJCOPY) -O ihex -j.eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $@ $(v)$(OBJCOPY) -O ihex -j.eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $@
# Make the buildroot
$(BUILDROOT):
@mkdir -p $(BUILDROOT)
# #
# Build sketch objects # Build sketch objects
# #
...@@ -425,7 +431,7 @@ $(CORELIB): $(CORELIBOBJS) ...@@ -425,7 +431,7 @@ $(CORELIB): $(CORELIBOBJS)
# In addition, we add #line directives wherever the originating file changes # In addition, we add #line directives wherever the originating file changes
# to help backtrack from compiler messages and in the debugger. # to help backtrack from compiler messages and in the debugger.
# #
$(SKETCHCPP): $(SKETCHCPP_SRC) $(BUILDROOT) $(SKETCHCPP): $(SKETCHCPP_SRC)
$(RULEHDR) $(RULEHDR)
$(v)$(AWK) -v mode=header '$(SKETCH_SPLITTER)' $(SKETCHCPP_SRC) > $@ $(v)$(AWK) -v mode=header '$(SKETCH_SPLITTER)' $(SKETCHCPP_SRC) > $@
$(v)echo "#line 1 \"autogenerated\"" >> $@ $(v)echo "#line 1 \"autogenerated\"" >> $@
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment