From 56752f402727154ed7d7668654a2d9c625fcfc10 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 11 Dec 2013 09:59:41 +1100 Subject: [PATCH] build: reduced PX4 warnings and avoid rebuilding when possible --- mk/px4_targets.mk | 14 +++++++++----- mk/sketch_sources.mk | 10 ++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mk/px4_targets.mk b/mk/px4_targets.mk index bd955470ba..3847d5b819 100644 --- a/mk/px4_targets.mk +++ b/mk/px4_targets.mk @@ -32,16 +32,20 @@ PX4_V2_CONFIG_FILE=$(MK_DIR)/PX4/config_px4fmu-v2_APM.mk SKETCHFLAGS=$(SKETCHLIBINCLUDES) -I$(PWD) -DARDUPILOT_BUILD -DCONFIG_HAL_BOARD=HAL_BOARD_PX4 -DSKETCHNAME="\\\"$(SKETCH)\\\"" -DSKETCH_MAIN=ArduPilot_main -PX4_MAKE = make -C $(SKETCHBOOK) -f $(PX4_ROOT)/Makefile EXTRADEFINES="$(SKETCHFLAGS) "'$(EXTRAFLAGS)' APM_MODULE_DIR=$(SKETCHBOOK) SKETCHBOOK=$(SKETCHBOOK) PX4_ROOT=$(PX4_ROOT) NUTTX_SRC=$(NUTTX_SRC) MAXOPTIMIZATION="-Os" +WARNFLAGS = -Wno-psabi + +PX4_MAKE = $(v) make -C $(SKETCHBOOK) -f $(PX4_ROOT)/Makefile EXTRADEFINES="$(SKETCHFLAGS) $(WARNFLAGS) "'$(EXTRAFLAGS)' APM_MODULE_DIR=$(SKETCHBOOK) SKETCHBOOK=$(SKETCHBOOK) PX4_ROOT=$(PX4_ROOT) NUTTX_SRC=$(NUTTX_SRC) MAXOPTIMIZATION="-Os" PX4_MAKE_ARCHIVES = make -C $(PX4_ROOT) NUTTX_SRC=$(NUTTX_SRC) archives MAXOPTIMIZATION="-Os" .PHONY: module_mk module_mk: $(RULEHDR) - $(v) echo "# Auto-generated file - do not edit" > $(SKETCHBOOK)/module.mk - $(v) echo "MODULE_COMMAND = ArduPilot" >> $(SKETCHBOOK)/module.mk - $(v) echo "SRCS = Build.$(SKETCH)/$(SKETCH).cpp $(SKETCHLIBSRCSRELATIVE)" >> $(SKETCHBOOK)/module.mk - $(v) echo "MODULE_STACKSIZE = 4096" >> $(SKETCHBOOK)/module.mk + $(v) echo "# Auto-generated file - do not edit" > $(SKETCHBOOK)/module.mk.new + $(v) echo "MODULE_COMMAND = ArduPilot" >> $(SKETCHBOOK)/module.mk.new + $(v) echo "SRCS = Build.$(SKETCH)/$(SKETCH).cpp $(SKETCHLIBSRCSRELATIVE)" >> $(SKETCHBOOK)/module.mk.new + $(v) echo "MODULE_STACKSIZE = 4096" >> $(SKETCHBOOK)/module.mk.new + $(v) cmp $(SKETCHBOOK)/module.mk $(SKETCHBOOK)/module.mk.new 2>/dev/null || mv $(SKETCHBOOK)/module.mk.new $(SKETCHBOOK)/module.mk + $(v) rm -f $(SKETCHBOOK)/module.mk.new px4-v1: showflags $(PX4_ROOT)/Archives/px4fmu-v1.export $(SKETCHCPP) module_mk px4-io-v1 $(RULEHDR) diff --git a/mk/sketch_sources.mk b/mk/sketch_sources.mk index c15a9720f1..df68112162 100644 --- a/mk/sketch_sources.mk +++ b/mk/sketch_sources.mk @@ -70,10 +70,12 @@ showflags: $(SKETCHCPP): showflags $(SKETCHCPP_SRC) @echo "building $(SKETCHCPP)" $(RULEHDR) - $(v)$(AWK) -v mode=header '$(SKETCH_SPLITTER)' $(SKETCHCPP_SRC) > $@ - $(v)echo "#line 1 \"autogenerated\"" >> $@ - $(v)$(AWK) '$(SKETCH_PROTOTYPER)' $(SKETCHCPP_SRC) >> $@ - $(v)$(AWK) -v mode=body '$(SKETCH_SPLITTER)' $(SKETCHCPP_SRC) >> $@ + $(v)$(AWK) -v mode=header '$(SKETCH_SPLITTER)' $(SKETCHCPP_SRC) > $@.new + $(v)echo "#line 1 \"autogenerated\"" >> $@.new + $(v)$(AWK) '$(SKETCH_PROTOTYPER)' $(SKETCHCPP_SRC) >> $@.new + $(v)$(AWK) -v mode=body '$(SKETCH_SPLITTER)' $(SKETCHCPP_SRC) >> $@.new + $(v)cmp $@ $@.new 2>/dev/null || mv $@.new $@ + $(v)rm -f $@.new # delete the sketch.cpp file if a processing error occurs .DELETE_ON_ERROR: $(SKETCHCPP)