SRC = $(TARGET)_C.c $(TARGET)_CPP.cpp Dummy.S $(LUFA_SRC_USB)\r
LUFA_PATH = ../../LUFA/\r
\r
-CC_FLAGS = -Wextra\r
-#CC_FLAGS += -Werror # FIXME\r
+# Generic C/C++ compiler flags\r
+CC_FLAGS = -Wextra\r
+CC_FLAGS += -Werror\r
CC_FLAGS += -Wformat=2\r
CC_FLAGS += -Winit-self\r
CC_FLAGS += -Wswitch-enum\r
CC_FLAGS += -Wcast-align\r
CC_FLAGS += -Wwrite-strings\r
CC_FLAGS += -Wlogical-op\r
-CC_FLAGS += -Wmissing-parameter-type\r
CC_FLAGS += -Wmissing-declarations\r
CC_FLAGS += -Wmissing-field-initializers\r
CC_FLAGS += -Wmissing-format-attribute\r
-CC_FLAGS += -Wnested-externs\r
CC_FLAGS += -Woverlength-strings\r
\r
# Only enable rendundant declaration warnings for AVR8 target (FIXME)\r
CC_FLAGS += -Wredundant-decls\r
endif\r
\r
+# C compiler only flags\r
+C_FLAGS += -Wmissing-parameter-type\r
+C_FLAGS += -Wnested-externs\r
+\r
# Potential additional warnings to enable in the future (FIXME)\r
#CC_FLAGS += -Wswitch-default\r
#CC_FLAGS += -Wc++-compat\r
# C_STANDARD - C Language Standard to use\r
# CPP_STANDARD - C++ Language Standard to use\r
# F_CPU - Speed of the CPU, in Hz\r
-# CC_FLAGS - Flags to pass to the compiler\r
+# C_FLAGS - Flags to pass to the C compiler only\r
+# CPP_FLAGS - Flags to pass to the C++ compiler only\r
+# ASM_FLAGS - Flags to pass to the assembler only\r
+# CC_FLAGS - Common flags to pass to the C/C++ compiler and\r
+# assembler\r
# LD_FLAGS - Flags to pass to the linker\r
#\r
# -----------------------------------------------------------------------------\r
F_CPU ?=\r
C_STANDARD ?= gnu99\r
CPP_STANDARD ?= gnu++98\r
+C_FLAGS ?=\r
+CPP_FLAGS ?=\r
+ASM_FLAGS ?=\r
+CC_FLAGS ?=\r
\r
# Convert input source file list to differentiate them by type\r
C_SOURCE = $(filter %.c, $(SRC))\r
else\r
$(error Unsupported architecture.)\r
endif\r
-CC_FLAGS += -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections\r
-CC_FLAGS += -Wall -Wstrict-prototypes\r
+CC_FLAGS += -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections\r
CC_FLAGS += -I. -I$(LUFA_PATH)/..\r
CC_FLAGS += -DARCH=ARCH_$(ARCH) -DBOARD=BOARD_$(BOARD) -DF_USB=$(F_USB)UL\r
ifneq ($(F_CPU),)\r
CC_FLAGS += -DF_CPU=$(F_CPU)UL\r
endif\r
\r
+# Additional language specific compiler flags\r
+C_FLAGS += -Wstrict-prototypes\r
+\r
# Create a list of flags to pass to the linker\r
LD_FLAGS += -Wl,-Map=$(TARGET).map,--cref -Wl,--gc-sections -lm\r
ifneq ($(F_CPU), UC3)\r
\r
%.o: %.c\r
@echo $(MSG_COMPILE_CMD) Compiling C file \"$^\"\r
- $(CROSS)gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) -std=$(C_STANDARD) $< -o $@\r
+ $(CROSS)gcc -c $(CC_FLAGS) $(C_FLAGS) -O$(OPTIMIZATION) -std=$(C_STANDARD) $< -o $@\r
\r
%.o: %.cpp\r
@echo $(MSG_COMPILE_CMD) Compiling C++ file \"$^\"\r
- $(CROSS)gcc -c $(CC_FLAGS) -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -x c++ $< -o $@\r
+ $(CROSS)gcc -c $(CC_FLAGS) $(CPP_FLAGS) -O$(OPTIMIZATION) -std=$(CPP_STANDARD) -x c++ $< -o $@\r
\r
%.o: %.S\r
@echo $(MSG_COMPILE_CMD) Assembling \"$^\"\r
- $(CROSS)gcc -c $(CC_FLAGS) -x assembler-with-cpp $< -o $@\r
+ $(CROSS)gcc -c $(CC_FLAGS) $(ASM_FLAGS) -x assembler-with-cpp $< -o $@\r
\r
.PRECIOUS : $(OBJECT_FILES)\r
%.elf: $(OBJECT_FILES)\r