5
0
mirror of https://github.com/ArduPilot/ardupilot synced 2025-01-08 17:08:28 -04:00

build: fixed dependency on frame type and options

this ensures "make sitl-heli" rebuilds after a "make sitl"

Thanks to Michael Oborne for reporting this
This commit is contained in:
Andrew Tridgell 2015-06-01 10:09:43 +10:00
parent 1797e2baa8
commit 65d0ecdef7
5 changed files with 50 additions and 120 deletions

View File

@ -191,41 +191,4 @@ $(SKETCHEEP): $(SKETCHELF)
$(RULEHDR)
$(v)$(OBJCOPY) -O ihex -j.eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $@
#
# Build sketch objects
#
SKETCH_INCLUDES = $(SKETCHLIBINCLUDES) $(ARDUINOLIBINCLUDES) $(COREINCLUDES)
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< -I$(SRCROOT) $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
#
# Build library objects from sources in the sketchbook
#
SLIB_INCLUDES = -I$(dir $<)/utility $(SKETCHLIBINCLUDES) $(ARDUINOLIBINCLUDES) $(COREINCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
include $(MK_DIR)/build_rules.mk

View File

@ -175,41 +175,4 @@ $(SKETCHEEP): $(SKETCHELF)
$(RULEHDR)
$(v)$(OBJCOPY) -O ihex -j.eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $@
#
# Build sketch objects
#
SKETCH_INCLUDES = $(SKETCHLIBINCLUDES) $(ARDUINOLIBINCLUDES) $(COREINCLUDES)
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< -I$(SRCROOT) $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
#
# Build library objects from sources in the sketchbook
#
SLIB_INCLUDES = -I$(dir $<)/utility $(SKETCHLIBINCLUDES) $(ARDUINOLIBINCLUDES) $(COREINCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
include $(MK_DIR)/build_rules.mk

View File

@ -95,47 +95,11 @@ print-%:
-include $(ALLDEPS)
# Link the final object
$(SKETCHELF): $(SKETCHOBJS) $(LIBOBJS)
$(SKETCHELF): $(SKETCHOBJS) $(LIBOBJS)
@echo "Building $(SKETCHELF)"
$(RULEHDR)
$(v)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(v)$(LD) $(LDFLAGS) -o $@ $(SKETCHOBJS) $(LIBOBJS) $(LIBS)
$(v)cp $(SKETCHELF) .
@echo "Firmware is in $(BUILDELF)"
#
# Build sketch objects
#
SKETCH_INCLUDES = $(SKETCHLIBINCLUDES)
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< -I$(SRCROOT) $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
#
# Build library objects from sources in the sketchbook
#
SLIB_INCLUDES = -I$(dir $<)/utility $(SKETCHLIBINCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
include $(MK_DIR)/build_rules.mk

38
mk/build_rules.mk Normal file
View File

@ -0,0 +1,38 @@
#
# Build sketch objects
#
SKETCH_INCLUDES = $(SKETCHLIBINCLUDES)
$(BUILDROOT)/%.o: $(BUILDROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< -I$(SRCROOT) $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(BUILDROOT)/make.flags $(SRCROOT)/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $*.cpp $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
$(BUILDROOT)/%.o: $(SRCROOT)/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SKETCH_INCLUDES)
#
# Build library objects from sources in the sketchbook
#
SLIB_INCLUDES = -I$(dir $<)/utility $(SKETCHLIBINCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.cpp
$(RULEHDR)
$(v)$(CXX) $(CXXFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.c
$(RULEHDR)
$(v)$(CC) $(CFLAGS) -c -o $@ $< $(SLIB_INCLUDES)
$(BUILDROOT)/libraries/%.o: $(SKETCHBOOK)/libraries/%.S
$(RULEHDR)
$(v)$(AS) $(ASFLAGS) -c -o $@ $< $(SLIB_INCLUDES)

View File

@ -77,12 +77,14 @@ else
v =
endif
.PHONY: $(BUILDROOT)/make.flags
$(BUILDROOT)/make.flags:
@mkdir -p $(BUILDROOT)
@echo "// BUILDROOT=$(BUILDROOT) HAL_BOARD=$(HAL_BOARD) HAL_BOARD_SUBTYPE=$(HAL_BOARD_SUBTYPE) TOOLCHAIN=$(TOOLCHAIN) EXTRAFLAGS=$(EXTRAFLAGS)" > $(BUILDROOT)/make.flags
@cat $(BUILDROOT)/make.flags
FORCE:
$(BUILDROOT)/make.flags: FORCE
@mkdir -p $(BUILDROOT)
@echo "// BUILDROOT=$(BUILDROOT) HAL_BOARD=$(HAL_BOARD) HAL_BOARD_SUBTYPE=$(HAL_BOARD_SUBTYPE) TOOLCHAIN=$(TOOLCHAIN) EXTRAFLAGS=$(EXTRAFLAGS)" > $(BUILDROOT)/make.flags.new
@cmp $(BUILDROOT)/make.flags $(BUILDROOT)/make.flags.new > /dev/null 2>&1 || mv $(BUILDROOT)/make.flags.new $(BUILDROOT)/make.flags
@rm -f $(BUILDROOT)/make.flags.new
@cat $(BUILDROOT)/make.flags
ifeq (,$(MAKE_INC))
# Build the sketch.cpp file