Re-organize build system

This commit is contained in:
Thomas Klaehn
2020-03-30 11:45:29 +02:00
parent 3093a80f2a
commit 2e01aa6877
22 changed files with 86 additions and 11447 deletions

View File

@@ -10,6 +10,7 @@ CPP = $(CROSS_COMPILE)cpp
CXX = $(CROSS_COMPILE)g++
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
CHECK = cppcheck
SRC_DIR = src
OBJ_DIR = obj/$(PLATFORM)
@@ -37,7 +38,7 @@ THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
INCLUDES += src/
INCLUDES += interfaces/
INCLUDES += include/
INCLUDES += include/application/$(APPLICATION)
INCLUDES += include/platform/$(PLATFORM)
OPT = 3
C_FLAGS += -O$(OPT) -g$(OPT)
@@ -50,11 +51,12 @@ CXX_FLAGS += -Wall -Werror
CXX_FLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CXX_FLAGS += -DPLATFORM_$(PLATFORM)
LIBS += c nosys m
CHECK_FLAGS = $(addprefix -I,$(INCLUDES))
CHECK_FLAGS += --enable=all --template=gcc --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr --force --language=c++
include config/build/$(PLATFORM)/$(APPLICATION)/Makefile.$(APPLICATION)
include build_system/platform/$(PLATFORM)/Makefile.$(PLATFORM)
.PHONY: all install uninstall clean distclean debug
.PHONY: all install uninstall clean distclean debug check
all: $(TARGET)
debug:
@@ -67,6 +69,10 @@ clean:
distclean:
rm -rf bin obj
.PHONY:
check: $(C_SRCS)
$(CHECK) $(CHECK_FLAGS) $(CC_SRCS)
$(TARGET): $(OBJS) $(THIS_MAKEFILE)
@mkdir -p $(dir $@)
$(CXX) $(CXX_FLAGS) $(LD_FLAGS) $(OBJS) $(addprefix -l,$(LIBS)) -o $@