aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2012-06-02 11:18:28 +0000
committerDean Camera <dean@fourwalledcubicle.com>2012-06-02 11:18:28 +0000
commit924c0eb6ac80186297769e5d41065831b2903573 (patch)
treef0cbeb70a965a917a4c2258ef3ca0f11a85437b6 /LUFA
parent8031d97a4f0dac1351d3ccfa999327bc3281d1df (diff)
downloadlufa-924c0eb6ac80186297769e5d41065831b2903573.tar.gz
lufa-924c0eb6ac80186297769e5d41065831b2903573.tar.bz2
lufa-924c0eb6ac80186297769e5d41065831b2903573.zip
Add C_FLAGS, CPP_FLAGS and ASM_FLAGS variables to the build system BUILD module to allow for language-specific compiler/assembler flags.
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/Build/lufa.build.in22
1 files changed, 16 insertions, 6 deletions
diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in
index be14a6fdc..d9d6b9fe5 100644
--- a/LUFA/Build/lufa.build.in
+++ b/LUFA/Build/lufa.build.in
@@ -42,7 +42,11 @@ LUFA_BUILD_TARGETS += size checksource all elf hex clean
# C_STANDARD - C Language Standard to use
# CPP_STANDARD - C++ Language Standard to use
# F_CPU - Speed of the CPU, in Hz
-# CC_FLAGS - Flags to pass to the compiler
+# C_FLAGS - Flags to pass to the C compiler only
+# CPP_FLAGS - Flags to pass to the C++ compiler only
+# ASM_FLAGS - Flags to pass to the assembler only
+# CC_FLAGS - Common flags to pass to the C/C++ compiler and
+# assembler
# LD_FLAGS - Flags to pass to the linker
#
# -----------------------------------------------------------------------------
@@ -83,6 +87,10 @@ OPTIMIZATION ?= s
F_CPU ?=
C_STANDARD ?= gnu99
CPP_STANDARD ?= gnu++98
+C_FLAGS ?=
+CPP_FLAGS ?=
+ASM_FLAGS ?=
+CC_FLAGS ?=
# Convert input source file list to differentiate them by type
C_SOURCE = $(filter %.c, $(SRC))
@@ -105,14 +113,16 @@ else ifeq ($(ARCH), UC3)
else
$(error Unsupported architecture.)
endif
-CC_FLAGS += -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections
-CC_FLAGS += -Wall -Wstrict-prototypes
+CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections
CC_FLAGS += -I. -I$(LUFA_PATH)/..
CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL
ifneq ($(F_CPU),)
CC_FLAGS += -DF_CPU=$(F_CPU)UL
endif
+# Additional language specific compiler flags
+C_FLAGS += -Wstrict-prototypes
+
# Create a list of flags to pass to the linker
LD_FLAGS += -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections -lm
ifneq ($(F_CPU), UC3)
@@ -162,15 +172,15 @@ lss: $(TARGET).lss
%.o: %.c
@echo $(MSG_COMPILE_CMD) Compiling C file \"$^\"
- $(CROSS)gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) -std=$(C_STANDARD) $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) $(C_FLAGS) -O$(OPTIMIZATION) -std=$(C_STANDARD) $< -o $@
%.o: %.cpp
@echo $(MSG_COMPILE_CMD) Compiling C++ file \"$^\"
- $(CROSS)gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -x c++ $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) $(CPP_FLAGS) -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -x c++ $< -o $@
%.o: %.S
@echo $(MSG_COMPILE_CMD) Assembling \"$^\"
- $(CROSS)gcc -c $(CC_FLAGS) -x assembler-with-cpp $< -o $@
+ $(CROSS)gcc -c $(CC_FLAGS) $(ASM_FLAGS) -x assembler-with-cpp $< -o $@
.PRECIOUS : $(OBJECT_FILES)
%.elf: $(OBJECT_FILES)