all: Use += rather than = everywhere for CFLAGS/LDFLAGS/LIBS.
This avoids a surprise where an = can cancel out an earlier +=. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
8e912a501a
commit
17f2783e4a
@ -98,8 +98,8 @@ We also need a Makefile at this point for the port:
|
||||
include $(TOP)/extmod/extmod.mk
|
||||
|
||||
# Set CFLAGS and libraries.
|
||||
CFLAGS = -I. -I$(BUILD) -I$(TOP)
|
||||
LIBS = -lm
|
||||
CFLAGS += -I. -I$(BUILD) -I$(TOP)
|
||||
LIBS += -lm
|
||||
|
||||
# Define the required source files.
|
||||
SRC_C = \
|
||||
|
@ -1,6 +1,6 @@
|
||||
MPTOP = ../..
|
||||
CFLAGS = -std=c99 -I. -I$(MPTOP) -DNO_QSTR
|
||||
LDFLAGS = -L./build
|
||||
CFLAGS += -std=c99 -I. -I$(MPTOP) -DNO_QSTR
|
||||
LDFLAGS += -L./build
|
||||
|
||||
hello-embed: hello-embed.o -lmicropython
|
||||
|
||||
|
@ -20,7 +20,7 @@ INC += -I$(BUILD)
|
||||
# compiler settings
|
||||
CWARN = -Wall -Werror
|
||||
CWARN += -Wpointer-arith -Wuninitialized
|
||||
CFLAGS = $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
|
||||
# Some systems (eg MacOS) need -fno-common so that mp_state_ctx is placed in the BSS.
|
||||
CFLAGS += -fno-common
|
||||
@ -70,7 +70,7 @@ else
|
||||
# Use gcc syntax for map file
|
||||
LDFLAGS_ARCH = -Wl,-Map=$@.map,--cref
|
||||
endif
|
||||
LDFLAGS = $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
||||
LDFLAGS += $(LDFLAGS_MOD) $(LDFLAGS_ARCH) -lm $(LDFLAGS_EXTRA)
|
||||
|
||||
ifeq ($(MICROPY_FORCE_32BIT),1)
|
||||
# Note: you may need to install i386 versions of dependency packages,
|
||||
|
@ -20,7 +20,7 @@ include ../../py/mkenv.mk
|
||||
CROSS_COMPILE ?= arm-none-eabi-
|
||||
|
||||
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -march=armv7e-m -mabi=aapcs -mcpu=cortex-m4 -msoft-float -mfloat-abi=soft -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS = -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4) -Os
|
||||
CFLAGS += -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4) -Os
|
||||
CFLAGS += -g -ffunction-sections -fdata-sections -fno-common -fsigned-char -mno-unaligned-access
|
||||
CFLAGS += -Iboards/$(BOARD)
|
||||
CFLAGS += $(CFLAGS_MOD)
|
||||
@ -28,7 +28,7 @@ CFLAGS += $(CFLAGS_MOD)
|
||||
# Workaround gcc 12.1 bug.
|
||||
CFLAGS += -Wno-array-bounds
|
||||
|
||||
LDFLAGS = -Wl,-nostdlib -Wl,--gc-sections -Wl,-Map=$@.map
|
||||
LDFLAGS += -Wl,-nostdlib -Wl,--gc-sections -Wl,-Map=$@.map
|
||||
|
||||
FLASH_SIZE_WIPY = 2M
|
||||
FLASH_SIZE_LAUNCHXL = 1M
|
||||
|
@ -57,12 +57,12 @@ CFLAGS_XTENSA = -fsingle-precision-constant -Wdouble-promotion \
|
||||
-Wl,-EL -mlongcalls -mtext-section-literals -mforce-l32 \
|
||||
-DLWIP_OPEN_SRC
|
||||
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib -DUART_OS=$(UART_OS) \
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 -nostdlib -DUART_OS=$(UART_OS) \
|
||||
$(CFLAGS_XTENSA) $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA) -I$(BOARD_DIR)
|
||||
|
||||
LD_FILES ?= boards/esp8266_2m.ld
|
||||
LDFLAGS = -nostdlib -T $(LD_FILES) -Map=$(@:.elf=.map) --cref
|
||||
LIBS = -L$(ESP_SDK)/lib -lmain -ljson -llwip_open -lpp -lnet80211 -lwpa -lphy -lnet80211 $(LDFLAGS_MOD)
|
||||
LDFLAGS += -nostdlib -T $(LD_FILES) -Map=$(@:.elf=.map) --cref
|
||||
LIBS += -L$(ESP_SDK)/lib -lmain -ljson -llwip_open -lpp -lnet80211 -lwpa -lphy -lnet80211 $(LDFLAGS_MOD)
|
||||
|
||||
LIBGCC_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
LIBS += -L$(dir $(LIBGCC_FILE_NAME)) -lgcc
|
||||
|
@ -393,7 +393,7 @@ CFLAGS += $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
# Linker Flags
|
||||
# =============================================================================
|
||||
|
||||
LDFLAGS = \
|
||||
LDFLAGS += \
|
||||
--cref \
|
||||
--gc-sections \
|
||||
--print-memory-usage \
|
||||
|
@ -23,12 +23,12 @@ ifeq ($(CROSS), 1)
|
||||
DFU = $(TOP)/tools/dfu.py
|
||||
PYDFU = $(TOP)/tools/pydfu.py
|
||||
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -msoft-float -fsingle-precision-constant -Wdouble-promotion -Wfloat-conversion
|
||||
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
|
||||
LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
|
||||
CFLAGS += $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
|
||||
LDFLAGS += -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
|
||||
else
|
||||
LD = gcc
|
||||
CFLAGS = $(INC) -Wall -Werror -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
|
||||
LDFLAGS = -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
||||
CFLAGS += $(INC) -Wall -Werror -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
|
||||
LDFLAGS += -Wl,-Map=$@.map,--cref -Wl,--gc-sections
|
||||
endif
|
||||
|
||||
CSUPEROPT = -Os # save some code space
|
||||
|
@ -129,7 +129,7 @@ CFLAGS += -fno-strict-aliasing
|
||||
CFLAGS += -Iboards/$(BOARD)
|
||||
CFLAGS += -DNRF5_HAL_H='<$(MCU_VARIANT)_hal.h>'
|
||||
|
||||
LDFLAGS = $(CFLAGS)
|
||||
LDFLAGS += $(CFLAGS)
|
||||
LDFLAGS += -Xlinker -Map=$(@:.elf=.map)
|
||||
LDFLAGS += -mthumb -mabi=aapcs $(addprefix -T,$(LD_FILES)) -L boards/
|
||||
|
||||
|
@ -21,7 +21,7 @@ INC += -I$(XC16)/include
|
||||
INC += -I$(XC16)/support/$(PARTFAMILY)/h
|
||||
|
||||
CFLAGS_PIC16BIT = -mcpu=$(PART) -mlarge-code
|
||||
CFLAGS = $(INC) -Wall -Werror -std=gnu99 -nostdlib $(CFLAGS_PIC16BIT) $(COPT)
|
||||
CFLAGS += $(INC) -Wall -Werror -std=gnu99 -nostdlib $(CFLAGS_PIC16BIT) $(COPT)
|
||||
|
||||
#Debugging/Optimization
|
||||
ifeq ($(DEBUG), 1)
|
||||
@ -30,8 +30,8 @@ else
|
||||
CFLAGS += -O1 -DNDEBUG
|
||||
endif
|
||||
|
||||
LDFLAGS = --heap=0 -nostdlib -T $(XC16)/support/$(PARTFAMILY)/gld/p$(PART).gld -Map=$@.map --cref -p$(PART)
|
||||
LIBS = -L$(XC16)/lib -L$(XC16)/lib/$(PARTFAMILY) -lc -lm -lpic30
|
||||
LDFLAGS += --heap=0 -nostdlib -T $(XC16)/support/$(PARTFAMILY)/gld/p$(PART).gld -Map=$@.map --cref -p$(PART)
|
||||
LIBS += -L$(XC16)/lib -L$(XC16)/lib/$(PARTFAMILY) -lc -lm -lpic30
|
||||
|
||||
SRC_C = \
|
||||
main.c \
|
||||
|
@ -21,14 +21,14 @@ INC += -I.
|
||||
INC += -I$(TOP)
|
||||
INC += -I$(BUILD)
|
||||
|
||||
CFLAGS = $(INC) -g -Wall -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
|
||||
CFLAGS += $(INC) -g -Wall -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
|
||||
CFLAGS += -mno-string -mno-multiple -mno-vsx -mno-altivec -nostdlib
|
||||
CFLAGS += -mlittle-endian -mstrict-align -msoft-float
|
||||
CFLAGS += -Os
|
||||
CFLAGS += -fdata-sections -ffunction-sections -fno-stack-protector -ffreestanding
|
||||
CFLAGS += -U_FORTIFY_SOURCE
|
||||
|
||||
LDFLAGS = -N -T powerpc.lds -nostdlib
|
||||
LDFLAGS += -N -T powerpc.lds -nostdlib
|
||||
|
||||
LIBS =
|
||||
|
||||
|
@ -139,7 +139,7 @@ CFLAGS += -fsingle-precision-constant
|
||||
endif
|
||||
endif
|
||||
|
||||
LDFLAGS = -nostdlib -L $(LD_DIR) $(addprefix -T,$(LD_FILES)) -Map=$(@:.elf=.map) --cref
|
||||
LDFLAGS += -nostdlib -L $(LD_DIR) $(addprefix -T,$(LD_FILES)) -Map=$(@:.elf=.map) --cref
|
||||
LDFLAGS += --defsym=_estack_reserve=8
|
||||
LIBS += "$(shell $(CC) $(CFLAGS) -print-libgcc-file-name)"
|
||||
|
||||
|
@ -58,15 +58,15 @@ GEN_PINS_HDR = $(BUILD)/pins.h
|
||||
|
||||
CFLAGS_MCU_SAMD21 = -mtune=cortex-m0plus -mcpu=cortex-m0plus -msoft-float
|
||||
CFLAGS_MCU_SAMD51 = -mtune=cortex-m4 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib -mthumb $(CFLAGS_MCU_$(MCU_SERIES)) -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS += $(INC) -Wall -Werror -std=c99 -nostdlib -mthumb $(CFLAGS_MCU_$(MCU_SERIES)) -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS += -DMCU_$(MCU_SERIES) -D__$(CMSIS_MCU)__
|
||||
CFLAGS += $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += -DMPCONFIG_MCU_H='<boards/mpconfig_$(MCU_SERIES_LOWER).h>'
|
||||
|
||||
LDFLAGS = -nostdlib $(addprefix -T,$(LD_FILES)) -Map=$@.map --cref
|
||||
LDFLAGS += -nostdlib $(addprefix -T,$(LD_FILES)) -Map=$@.map --cref
|
||||
LDFLAGS += $(LDFLAGS_MOD)
|
||||
|
||||
LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
LIBS += $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
|
||||
# Tune for Debugging or Optimization
|
||||
CFLAGS += -g # always include debug info in the ELF
|
||||
|
@ -99,7 +99,7 @@ CFLAGS += -fsingle-precision-constant
|
||||
endif
|
||||
endif
|
||||
|
||||
LDFLAGS = -nostdlib -L $(LD_DIR) $(addprefix -T,$(LD_FILES)) -Wl,-Map=$(@:.elf=.map) -Wl,--cref
|
||||
LDFLAGS += -nostdlib -L $(LD_DIR) $(addprefix -T,$(LD_FILES)) -Wl,-Map=$(@:.elf=.map) -Wl,--cref
|
||||
LDFLAGS += -Wl,--defsym=_estack_reserve=8
|
||||
LIBS += "$(shell $(CC) $(CFLAGS) -print-libgcc-file-name)"
|
||||
|
||||
|
@ -58,7 +58,7 @@ INC += -I../$(USBDEV_DIR)/core/inc -I../$(USBDEV_DIR)/class/inc
|
||||
# the compiler does not optimise these functions in terms of themselves.
|
||||
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
|
||||
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Werror -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Werror -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA)
|
||||
CFLAGS += -D$(CMSIS_MCU)
|
||||
CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES))
|
||||
CFLAGS += $(COPT)
|
||||
@ -75,8 +75,8 @@ CFLAGS += -DMICROPY_HW_STM32WB_FLASH_SYNCRONISATION=0
|
||||
CFLAGS += -DBOOTLOADER_DFU_USB_VID=$(BOOTLOADER_DFU_USB_VID) -DBOOTLOADER_DFU_USB_PID=$(BOOTLOADER_DFU_USB_PID)
|
||||
|
||||
MBOOT_LD_FILES ?= stm32_memory.ld stm32_sections.ld
|
||||
LDFLAGS = -nostdlib -L . $(addprefix -T,$(MBOOT_LD_FILES)) -Map=$(@:.elf=.map) --cref
|
||||
LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
LDFLAGS += -nostdlib -L . $(addprefix -T,$(MBOOT_LD_FILES)) -Map=$(@:.elf=.map) --cref
|
||||
LIBS += $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
|
||||
# Remove uncalled code from the final image.
|
||||
CFLAGS += -fdata-sections -ffunction-sections
|
||||
|
@ -75,8 +75,8 @@ INC += -I$(TOP)/ports/stm32
|
||||
INC += -I$(BUILD)
|
||||
INC += -Icore
|
||||
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4)
|
||||
LDFLAGS = -nostdlib -T mk20dx256.ld -msoft-float -mfloat-abi=soft
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4)
|
||||
LDFLAGS += -nostdlib -T mk20dx256.ld -msoft-float -mfloat-abi=soft
|
||||
|
||||
ifeq ($(USE_ARDUINO_TOOLCHAIN),1)
|
||||
|
||||
|
@ -32,8 +32,8 @@ INC += -I$(BUILD)
|
||||
INC += -I$(VARIANT_DIR)
|
||||
|
||||
# compiler settings
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
LDFLAGS = $(LDFLAGS_MOD) -lm -lbcrypt $(LDFLAGS_EXTRA)
|
||||
CFLAGS += $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
|
||||
LDFLAGS += -lm -lbcrypt $(LDFLAGS_EXTRA)
|
||||
|
||||
# Debugging/Optimization
|
||||
ifdef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user