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
This commit is contained in:
parent
7bc153f038
commit
23e78d0f4b
@ -146,15 +146,16 @@ endif
|
||||
#
|
||||
DEFINES = -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERS)
|
||||
OPTFLAGS = -Os
|
||||
DEPFLAGS = -MD -MT $@
|
||||
|
||||
# XXX warning options TBD
|
||||
CXXOPTS = -mcall-prologues -ffunction-sections -fdata-sections -fno-exceptions
|
||||
COPTS = -mcall-prologues -ffunction-sections -fdata-sections
|
||||
ASOPTS = -assembler-with-cpp
|
||||
|
||||
CXXFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(CXXOPTS)
|
||||
CFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(COPTS)
|
||||
ASFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(ASOPTS)
|
||||
CXXFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(DEPFLAGS) $(CXXOPTS)
|
||||
CFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(OPTFLAGS) $(DEPFLAGS) $(COPTS)
|
||||
ASFLAGS = -g -mmcu=$(MCU) $(DEFINES) $(DEPFLAGS) $(ASOPTS)
|
||||
LDFLAGS = -g -mmcu=$(MCU) $(OPTFLAGS) -Wl,--gc-sections
|
||||
|
||||
LIBS = -lm
|
||||
@ -291,6 +292,12 @@ SKETCHEEP = $(BUILDROOT)/$(SKETCH).eep
|
||||
# The core library
|
||||
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
|
||||
#
|
||||
@ -306,6 +313,9 @@ clean:
|
||||
# Rules
|
||||
#
|
||||
|
||||
# fetch dependency info from a previous build if any of it exists
|
||||
-include $(ALLDEPS)
|
||||
|
||||
# common header for rules, prints what is being built
|
||||
define RULEHDR
|
||||
@echo %% $(subst $(BUILDROOT)/,,$@)
|
||||
@ -327,10 +337,6 @@ $(SKETCHEEP): $(SKETCHELF)
|
||||
$(RULEHDR)
|
||||
$(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
|
||||
#
|
||||
@ -425,7 +431,7 @@ $(CORELIB): $(CORELIBOBJS)
|
||||
# In addition, we add #line directives wherever the originating file changes
|
||||
# to help backtrack from compiler messages and in the debugger.
|
||||
#
|
||||
$(SKETCHCPP): $(SKETCHCPP_SRC) $(BUILDROOT)
|
||||
$(SKETCHCPP): $(SKETCHCPP_SRC)
|
||||
$(RULEHDR)
|
||||
$(v)$(AWK) -v mode=header '$(SKETCH_SPLITTER)' $(SKETCHCPP_SRC) > $@
|
||||
$(v)echo "#line 1 \"autogenerated\"" >> $@
|
||||
|
Loading…
Reference in New Issue
Block a user