rules: provide default C and C++ standards
Default CSTD to c99, no default for CXXSTD, but if provided it will be used. Add required gnu99 flags to projects using gnu styles.
This commit is contained in:
@@ -43,6 +43,7 @@ STYLECHECK := /checkpatch.pl
|
||||
STYLECHECKFLAGS := --no-tree -f --terse --mailback
|
||||
STYLECHECKFILES := $(shell find . -name '*.[ch]')
|
||||
OPT := -Os
|
||||
CSTD ?= -std=c99
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -96,7 +97,7 @@ SCRIPT_DIR = $(OPENCM3_DIR)/scripts
|
||||
###############################################################################
|
||||
# C flags
|
||||
|
||||
TGT_CFLAGS += $(OPT) -g
|
||||
TGT_CFLAGS += $(OPT) $(CSTD) -g
|
||||
TGT_CFLAGS += $(ARCH_FLAGS)
|
||||
TGT_CFLAGS += -Wextra -Wshadow -Wimplicit-function-declaration
|
||||
TGT_CFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes
|
||||
@@ -105,7 +106,7 @@ TGT_CFLAGS += -fno-common -ffunction-sections -fdata-sections
|
||||
###############################################################################
|
||||
# C++ flags
|
||||
|
||||
TGT_CXXFLAGS += $(OPT) -g
|
||||
TGT_CXXFLAGS += $(OPT) $(CXXSTD) -g
|
||||
TGT_CXXFLAGS += $(ARCH_FLAGS)
|
||||
TGT_CXXFLAGS += -Wextra -Wshadow -Wredundant-decls -Weffc++
|
||||
TGT_CXXFLAGS += -fno-common -ffunction-sections -fdata-sections
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
##
|
||||
|
||||
BINARY = usart_stdio
|
||||
CSTD = -std=gnu99
|
||||
|
||||
LDSCRIPT = ../stm32f0-discovery.ld
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
##
|
||||
|
||||
BINARY = usbdfu
|
||||
CSTD = -std=gnu99
|
||||
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = adc_injec
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = adc_injec_timtrig
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = adc_injec_timtrig_irq
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = adc_injec_timtrig_irq_4ch
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = adc
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = can
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = fancyblink
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = spi
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = spi_dma
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = spi_dma_adv
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = usart
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = usart_dma
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = usart_irq
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = usart_irq_printf
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -21,7 +21,6 @@ BINARY = usart_printf
|
||||
|
||||
# Comment the following line if you _don't_ have luftboot flashed!
|
||||
LDFLAGS += -Wl,-Ttext=0x8002000
|
||||
CFLAGS += -std=c99
|
||||
LDSCRIPT = ../lisa-m.ld
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
##
|
||||
|
||||
BINARY = usbdfu
|
||||
CSTD = -std=gnu99
|
||||
|
||||
include ../../Makefile.include
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
##
|
||||
|
||||
BINARY = usbdfu
|
||||
CSTD = -std=gnu99
|
||||
|
||||
LDSCRIPT = ../stm32-h103.ld
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
##
|
||||
|
||||
BINARY = usbiap
|
||||
CSTD = -std=gnu99
|
||||
|
||||
LDSCRIPT = ../stm32-h103.ld
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
OBJS = sdram.o clock.o console.o lcd-spi.o
|
||||
|
||||
BINARY = lcd-dma
|
||||
CSTD = -std=gnu99
|
||||
|
||||
# we use sin/cos from the library
|
||||
LDLIBS += -lm
|
||||
|
||||
Reference in New Issue
Block a user