From 5135d9d10e9266317ddc51d767f67a13cc6a21ef Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Fri, 7 Feb 2014 22:47:54 +0100 Subject: [PATCH] [build] optimization flag can be set from airframe file --- conf/Makefile.chibios-libopencm3 | 19 +++++-------------- conf/Makefile.geode | 2 +- conf/Makefile.jsbsim | 3 ++- conf/Makefile.lpc21 | 3 +-- conf/Makefile.nps | 4 ++-- conf/Makefile.omap | 2 +- conf/Makefile.pentium-m | 2 +- conf/Makefile.sim | 3 ++- conf/Makefile.stm32 | 6 +----- 9 files changed, 16 insertions(+), 28 deletions(-) diff --git a/conf/Makefile.chibios-libopencm3 b/conf/Makefile.chibios-libopencm3 index 0c3f39198a3..102ac4110c9 100644 --- a/conf/Makefile.chibios-libopencm3 +++ b/conf/Makefile.chibios-libopencm3 @@ -69,25 +69,16 @@ endif # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -std=gnu11 -g -O0 -ggdb3 -fno-inline \ - -falign-functions=16 -fno-omit-frame-pointer\ - -W -Wall -Werror -Wno-error=unused-variable -Wno-error=format \ - -Wno-error=unused-function -Wno-error=unused-parameter \ - $(PPRZ_DEFINITION) -endif -ifeq ($(USE_OPT),) - USE_OPT = -std=gnu11 -O2 \ + # ChibiOS already define OPT + CH_OPT ?= 0 -g -ggdb3 -fno-inline + + USE_OPT = -std=gnu11 -O$(CH_OPT) \ -falign-functions=16 -fno-omit-frame-pointer\ -W -Wall -Werror -Wno-error=unused-variable -Wno-error=format \ - -Wno-error=unused-function -Wno-error=unused-parameter \ + -Wno-error=unused-function -Wno-error=unused-parameter \ $(PPRZ_DEFINITION) endif -# ifeq ($(USE_OPT),) -# USE_OPT = -std=gnu11 -Os \ -# -falign-functions=16 -fomit-frame-pointer\ -# -W -Wall -DRTOS_IS_CHIBIOS -# endif # C specific options here (added to USE_OPT). ifeq ($(USE_COPT),) diff --git a/conf/Makefile.geode b/conf/Makefile.geode index fb3d7ee7454..dedaabf443f 100644 --- a/conf/Makefile.geode +++ b/conf/Makefile.geode @@ -27,7 +27,7 @@ LD = $(CC) # Launch with "make Q=''" to get full command display Q=@ -OPT=3 +OPT ?= 3 CSTANDARD = -std=gnu99 CINCS = $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/include diff --git a/conf/Makefile.jsbsim b/conf/Makefile.jsbsim index a2e00922f0b..04044e7c27b 100644 --- a/conf/Makefile.jsbsim +++ b/conf/Makefile.jsbsim @@ -29,6 +29,7 @@ SRC_ARCH = arch/sim CC = g++ SIMDIR = $(PAPARAZZI_SRC)/sw/simulator +OPT ?= 2 # Launch with "make Q=''" to get full command display Q=@ @@ -37,7 +38,7 @@ Q=@ # Compilation flags # -CFLAGS = -W -Wall $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/airborne/$(SRC_ARCH) $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) -O2 +CFLAGS = -W -Wall $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/airborne/$(SRC_ARCH) $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) -O$(OPT) LDFLAGS = -lm $($(TARGET).LDFLAGS) diff --git a/conf/Makefile.lpc21 b/conf/Makefile.lpc21 index be535d4193a..7313b7c2c91 100644 --- a/conf/Makefile.lpc21 +++ b/conf/Makefile.lpc21 @@ -68,8 +68,7 @@ ASRCARM = crt0.S # Optimization level, can be [0, 1, 2, 3, s]. # 0 = turn off optimization. s = optimize for size. -OPT = s -#OPT=3 +OPT ?= s CSTANDARD = -std=gnu99 diff --git a/conf/Makefile.nps b/conf/Makefile.nps index 5419f777eba..146590f3c31 100644 --- a/conf/Makefile.nps +++ b/conf/Makefile.nps @@ -27,7 +27,7 @@ SRC_ARCH = arch/sim CC = g++ - +OPT ?= 2 SIMDIR = $(PAPARAZZI_SRC)/sw/simulator # Launch with "make Q=''" to get full command display @@ -37,7 +37,7 @@ CFLAGS = -W -Wall CFLAGS += $(INCLUDES) CFLAGS += $($(TARGET).CFLAGS) CFLAGS += $(LOCAL_CFLAGS) -CFLAGS += -O2 +CFLAGS += -O$(OPT) CFLAGS += -g LDFLAGS += $($(TARGET).LDFLAGS) diff --git a/conf/Makefile.omap b/conf/Makefile.omap index ef4ff0cd35d..da5e15c86d7 100644 --- a/conf/Makefile.omap +++ b/conf/Makefile.omap @@ -31,7 +31,7 @@ include $(PAPARAZZI_SRC)/conf/Makefile.arm-linux-toolchain # Launch with "make Q=''" to get full command display Q=@ -OPT=3 +OPT ?= 3 CSTANDARD = -std=gnu99 CINCS = $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/include diff --git a/conf/Makefile.pentium-m b/conf/Makefile.pentium-m index 04f4771137c..39793920dfa 100644 --- a/conf/Makefile.pentium-m +++ b/conf/Makefile.pentium-m @@ -27,7 +27,7 @@ LD = $(CC) # Launch with "make Q=''" to get full command display Q=@ -OPT=3 +OPT ?= 3 # # OPT=O -g, turns off all optimization and turns on debugging. diff --git a/conf/Makefile.sim b/conf/Makefile.sim index 14b015a00c3..24de69e39b3 100644 --- a/conf/Makefile.sim +++ b/conf/Makefile.sim @@ -37,6 +37,7 @@ LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz SIMSITLML = $(OBJDIR)/simsitl.ml MYGTKINITCMO = myGtkInit.cmo SITLCMA = $(SIMDIR)/sitl.cma +OPT ?= 2 # Launch with "make Q=''" to get full command display Q=@ @@ -52,7 +53,7 @@ CFLAGS += $(INCLUDES) CFLAGS += $($(TARGET).CFLAGS) CFLAGS += $(LOCAL_CFLAGS) CFLAGS += -fPIC -CFLAGS += -O2 +CFLAGS += -O$(OPT) CFLAGS += -g CFLAGS += -std=gnu99 diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index 60a40deccce..d2ab9562b03 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -43,11 +43,7 @@ else MCU = cortex-m3 endif #DEBUG = dwarf-2 -OPT = s -#OPT = 2 -#OPT = 0 - - +OPT ?= s # input files SRCS = $($(TARGET).srcs)