From ff8edf8c51ba0499f89961279e536f55a8dc6fb2 Mon Sep 17 00:00:00 2001 From: tkl Date: Fri, 29 Jul 2016 08:37:13 +0200 Subject: [PATCH] makefile moved to root folder --- .cproject | 40 +++++++++---------- .gitlab-ci.yml | 4 -- source/Makefile => Makefile | 23 ++++++----- source/firmware/arch/arch.mk | 2 +- source/firmware/arch/stm32f4xx/board/board.mk | 6 +-- .../stm32f4-discovery/stm32f4-discovery.mk | 8 ++-- source/firmware/arch/stm32f4xx/cpu/cpu.mk | 4 +- .../firmware/arch/stm32f4xx/driver/driver.mk | 10 ++--- source/firmware/arch/stm32f4xx/lib/lib.mk | 2 +- .../arch/stm32f4xx/lib/stdperiph/stdperiph.mk | 8 ++-- source/firmware/arch/stm32f4xx/stm32f4xx.mk | 16 ++++---- source/firmware/firmware.mk | 4 +- source/firmware/kernel/driver/driver.mk | 8 ++-- source/firmware/kernel/kernel.mk | 12 +++--- 14 files changed, 73 insertions(+), 74 deletions(-) rename source/Makefile => Makefile (76%) diff --git a/.cproject b/.cproject index e76f694..91234d7 100755 --- a/.cproject +++ b/.cproject @@ -197,15 +197,15 @@ false true - + make - distclean + all true - false + true true - + make BOARD=stm32f4-discovery DEBUG=y all @@ -213,7 +213,7 @@ false true - + make BOARD=stm32f4-discovery DEBUG=y clean @@ -221,7 +221,7 @@ false true - + make BOARD=stm32f4-discovery DEBUG=y deploy @@ -229,7 +229,15 @@ false true - + + make + + distclean + true + false + true + + make BOARD=stm32f4-discovery all @@ -237,15 +245,7 @@ false true - - make - BOARD=stm32f4-discovery - deploy - true - false - true - - + make BOARD=stm32f4-discovery clean @@ -253,12 +253,12 @@ false true - + make - - all + BOARD=stm32f4-discovery + deploy true - true + false true diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 315bd02..5fe0068 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,6 @@ stages: build_job: script: - - "cd source" - "make all BOARD=stm32f4-discovery" stage: build except: @@ -30,19 +29,16 @@ build_job: check_job: script: - - "cd source" - "make check BOARD=stm32f4-discovery" stage: check #deploy_job: # script: -# - "cd source" # - "make deploy BOARD=stm32f4-discovery" # stage: deploy #test_job: # script: -# - "cd source" # - "make install APP=test BOARD=stm32f4-discovery" # stage: test diff --git a/source/Makefile b/Makefile similarity index 76% rename from source/Makefile rename to Makefile index 87bc700..eb9b4bb 100755 --- a/source/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # ############################################################## -include ../config/make/rules.mk +include config/make/rules.mk OS_NAME = kosmos @@ -15,16 +15,16 @@ CHECK_FOLDER := SOURCES := $(wildcard $(SRC_DIR)/*.c) ASM_SOURCES := $(wildcard $(SRC_DIR)/*.s) -OBJECTS = $(SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o) -ASM_OBJECTS = $(ASMSOURCES:$(SRC_DIR)/%.s=$(OBJ_DIR)/%.o) -DEPS = $(SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.d) +OBJECTS = $(SOURCES:$(ROOT_DIR)/%.c=$(OBJ_DIR)/%.o) +ASM_OBJECTS = $(ASMSOURCES:$(ROOT_DIR)/%.s=$(OBJ_DIR)/%.o) +DEPS = $(SOURCES:$(ROOT_DIR)/%.c=$(OBJ_DIR)/%.d) #include subfolders -include firmware/firmware.mk +include source/firmware/firmware.mk -SOURCES += $(foreach folder, $(SUB_FOLDER), $(wildcard $(SRC_DIR)/$(folder)/*.c)) -CHECKSOURCES += $(foreach folder, $(CHECK_FOLDER), $(wildcard $(SRC_DIR)/$(folder)/*.c)) -ASMSOURCES += $(foreach folder, $(SUB_FOLDER), $(wildcard $(SRC_DIR)/$(folder)/*.s)) +SOURCES += $(foreach folder, $(SUB_FOLDER), $(wildcard $(ROOT_DIR)/$(folder)/*.c)) +CHECKSOURCES += $(foreach folder, $(CHECK_FOLDER), $(wildcard $(ROOT_DIR)/$(folder)/*.c)) +ASMSOURCES += $(foreach folder, $(SUB_FOLDER), $(wildcard $(ROOT_DIR)/$(folder)/*.s)) all: check $(MAINFILE) @@ -35,6 +35,8 @@ deploy: all cp $(SRC_DIR)/firmware/kernel/interface/*.* $(EXE_DIR)/include/ check: + echo $(CHECK_FOLDER) + echo $(CHECKSOURCES) $(CPPCHECK) $(CPPCHECK_FLAGS) $(CHECKSOURCES) @@ -42,14 +44,14 @@ $(MAINFILE): $(OBJECTS) $(ASM_OBJECTS) @$(MKDIR) $(EXE_DIR) $(AR) rcs $(MAINFILE) $(OBJECTS) $(ASM_OBJECTS) -$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c +$(OBJ_DIR)/%.o: $(ROOT_DIR)/%.c @rm -rf $(LIB) @$(MKDIR) $(OBJ_DIR) @$(foreach folder, $(SUB_FOLDER), $(shell mkdir -p $(OBJ_DIR)/$(folder))) $(call makedep,$<,$@,$(subst .o,.d,$@)) $(CC) $(CFLAGS) -c $< -o $@ -$(OBJ_DIR)/%.o: $(SRC_DIR)/%.s +$(OBJ_DIR)/%.o: $(ROOT_DIR)/%.s @$(MKDIR) $(OBJ_DIR) @$(foreach folder, $(SUB_FOLDER), $(shell mkdir -p $(OBJ_DIR)/$(folder))) $(CC) $(CFLAGS) -c $< -o $@ @@ -58,6 +60,7 @@ clean: $(foreach folder, $(SUB_FOLDER), $(shell rm -f $(OBJ_DIR)/$(folder)/*.o)) $(foreach folder, $(SUB_FOLDER), $(shell rm -f $(OBJ_DIR)/$(folder)/*.d)) -rm -f $(OBJ_DIR)/*.o \ + $(EXE_DIR)/include/* \ $(OBJ_DIR)/*.d \ $(MAINFILE) diff --git a/source/firmware/arch/arch.mk b/source/firmware/arch/arch.mk index 63ae13e..455d155 100755 --- a/source/firmware/arch/arch.mk +++ b/source/firmware/arch/arch.mk @@ -1,3 +1,3 @@ ifeq ($(CPU), stm32f4xx) -include firmware/arch/stm32f4xx/stm32f4xx.mk +include source/firmware/arch/stm32f4xx/stm32f4xx.mk endif \ No newline at end of file diff --git a/source/firmware/arch/stm32f4xx/board/board.mk b/source/firmware/arch/stm32f4xx/board/board.mk index 384828a..4d66d0a 100755 --- a/source/firmware/arch/stm32f4xx/board/board.mk +++ b/source/firmware/arch/stm32f4xx/board/board.mk @@ -1,6 +1,6 @@ -INCLUDES += firmware/arch/stm32f4xx/board -DOC_SRC += firmware/arch/stm32f4xx/board +INCLUDES += source/firmware/arch/stm32f4xx/board +DOC_SRC += source/firmware/arch/stm32f4xx/board ifeq ($(BOARD), stm32f4-discovery) -include firmware/arch/stm32f4xx/board/stm32f4-discovery/stm32f4-discovery.mk +include source/firmware/arch/stm32f4xx/board/stm32f4-discovery/stm32f4-discovery.mk endif diff --git a/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/stm32f4-discovery.mk b/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/stm32f4-discovery.mk index 177208e..5ee2e64 100755 --- a/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/stm32f4-discovery.mk +++ b/source/firmware/arch/stm32f4xx/board/stm32f4-discovery/stm32f4-discovery.mk @@ -1,4 +1,4 @@ -CHECK_FOLDER += firmware/arch/stm32f4xx/board/stm32f4-discovery -SUB_FOLDER += firmware/arch/stm32f4xx/board/stm32f4-discovery -INCLUDES += firmware/arch/stm32f4xx/board/stm32f4-discovery/include -DOC_SRC += firmware/arch/stm32f4xx/board/stm32f4-discovery \ No newline at end of file +CHECK_FOLDER += source/firmware/arch/stm32f4xx/board/stm32f4-discovery +SUB_FOLDER += source/firmware/arch/stm32f4xx/board/stm32f4-discovery +INCLUDES += source/firmware/arch/stm32f4xx/board/stm32f4-discovery/include +DOC_SRC += source/firmware/arch/stm32f4xx/board/stm32f4-discovery \ No newline at end of file diff --git a/source/firmware/arch/stm32f4xx/cpu/cpu.mk b/source/firmware/arch/stm32f4xx/cpu/cpu.mk index 10aaaed..8178327 100755 --- a/source/firmware/arch/stm32f4xx/cpu/cpu.mk +++ b/source/firmware/arch/stm32f4xx/cpu/cpu.mk @@ -1,3 +1,3 @@ -INCLUDES += firmware/arch/stm32f4xx/cpu -DOC_SRC += firmware/arch/stm32f4xx/cpu +INCLUDES += source/firmware/arch/stm32f4xx/cpu +DOC_SRC += source/firmware/arch/stm32f4xx/cpu diff --git a/source/firmware/arch/stm32f4xx/driver/driver.mk b/source/firmware/arch/stm32f4xx/driver/driver.mk index 60edf11..5cb834c 100755 --- a/source/firmware/arch/stm32f4xx/driver/driver.mk +++ b/source/firmware/arch/stm32f4xx/driver/driver.mk @@ -1,5 +1,5 @@ -CHECK_FOLDER += firmware/arch/stm32f4xx/driver -SUB_FOLDER += firmware/arch/stm32f4xx/driver -INCLUDES += firmware/arch/stm32f4xx/driver/include -DOC_SRC += firmware/arch/stm32f4xx/driver -DOC_SRC += firmware/arch/stm32f4xx/driver/include +CHECK_FOLDER += source/firmware/arch/stm32f4xx/driver +SUB_FOLDER += source/firmware/arch/stm32f4xx/driver +INCLUDES += source/firmware/arch/stm32f4xx/driver/include +DOC_SRC += source/firmware/arch/stm32f4xx/driver +DOC_SRC += source/firmware/arch/stm32f4xx/driver/include diff --git a/source/firmware/arch/stm32f4xx/lib/lib.mk b/source/firmware/arch/stm32f4xx/lib/lib.mk index a924afd..ffc8bc4 100755 --- a/source/firmware/arch/stm32f4xx/lib/lib.mk +++ b/source/firmware/arch/stm32f4xx/lib/lib.mk @@ -1 +1 @@ -include firmware/arch/stm32f4xx/lib/stdperiph/stdperiph.mk +include source/firmware/arch/stm32f4xx/lib/stdperiph/stdperiph.mk diff --git a/source/firmware/arch/stm32f4xx/lib/stdperiph/stdperiph.mk b/source/firmware/arch/stm32f4xx/lib/stdperiph/stdperiph.mk index caa0523..80a4bf7 100755 --- a/source/firmware/arch/stm32f4xx/lib/stdperiph/stdperiph.mk +++ b/source/firmware/arch/stm32f4xx/lib/stdperiph/stdperiph.mk @@ -1,4 +1,4 @@ -SUB_FOLDER += firmware/arch/stm32f4xx/lib/stdperiph/src -INCLUDES += firmware/arch/stm32f4xx/lib/stdperiph/inc -INCLUDES += firmware/arch/stm32f4xx/lib/stdperiph/CMSIS/ST/STM32F4xx/Include -INCLUDES += firmware/arch/stm32f4xx/lib/stdperiph/CMSIS/Include +SUB_FOLDER += source/firmware/arch/stm32f4xx/lib/stdperiph/src +INCLUDES += source/firmware/arch/stm32f4xx/lib/stdperiph/inc +INCLUDES += source/firmware/arch/stm32f4xx/lib/stdperiph/CMSIS/ST/STM32F4xx/Include +INCLUDES += source/firmware/arch/stm32f4xx/lib/stdperiph/CMSIS/Include diff --git a/source/firmware/arch/stm32f4xx/stm32f4xx.mk b/source/firmware/arch/stm32f4xx/stm32f4xx.mk index 9dafce6..28eafbc 100755 --- a/source/firmware/arch/stm32f4xx/stm32f4xx.mk +++ b/source/firmware/arch/stm32f4xx/stm32f4xx.mk @@ -1,9 +1,9 @@ -CHECK_FOLDER += firmware/arch/stm32f4xx -SUB_FOLDER += firmware/arch/stm32f4xx -INCLUDES += firmware/arch/stm32f4xx/include -DOC_SRC += firmware/arch/stm32f4xx +CHECK_FOLDER += source/firmware/arch/stm32f4xx +SUB_FOLDER += source/firmware/arch/stm32f4xx +INCLUDES += source/firmware/arch/stm32f4xx/include +DOC_SRC += source/firmware/arch/stm32f4xx -include firmware/arch/stm32f4xx/board/board.mk -include firmware/arch/stm32f4xx/cpu/cpu.mk -include firmware/arch/stm32f4xx/driver/driver.mk -include firmware/arch/stm32f4xx/lib/lib.mk +include source/firmware/arch/stm32f4xx/board/board.mk +include source/firmware/arch/stm32f4xx/cpu/cpu.mk +include source/firmware/arch/stm32f4xx/driver/driver.mk +include source/firmware/arch/stm32f4xx/lib/lib.mk diff --git a/source/firmware/firmware.mk b/source/firmware/firmware.mk index affc254..87f80a4 100755 --- a/source/firmware/firmware.mk +++ b/source/firmware/firmware.mk @@ -1,2 +1,2 @@ -include firmware/arch/arch.mk -include firmware/kernel/kernel.mk +include source/firmware/arch/arch.mk +include source/firmware/kernel/kernel.mk diff --git a/source/firmware/kernel/driver/driver.mk b/source/firmware/kernel/driver/driver.mk index dfdaaba..a26ed25 100755 --- a/source/firmware/kernel/driver/driver.mk +++ b/source/firmware/kernel/driver/driver.mk @@ -1,4 +1,4 @@ -CHECK_FOLDER += firmware/kernel/driver -SUB_FOLDER += firmware/kernel/driver -INCLUDES += firmware/kernel/driver/include -DOC_SRC += firmware/kernel/driver +CHECK_FOLDER += source/firmware/kernel/driver +SUB_FOLDER += source/firmware/kernel/driver +INCLUDES += source/firmware/kernel/driver/include +DOC_SRC += source/firmware/kernel/driver diff --git a/source/firmware/kernel/kernel.mk b/source/firmware/kernel/kernel.mk index 3c2afc9..86c72ec 100755 --- a/source/firmware/kernel/kernel.mk +++ b/source/firmware/kernel/kernel.mk @@ -1,7 +1,7 @@ -CHECK_FOLDER += firmware/kernel -SUB_FOLDER += firmware/kernel -INCLUDES += firmware/kernel/include -INCLUDES += firmware/kernel/interface -DOC_SRC += firmware/kernel +CHECK_FOLDER += source/firmware/kernel +SUB_FOLDER += source/firmware/kernel +INCLUDES += source/firmware/kernel/include +INCLUDES += source/firmware/kernel/interface +DOC_SRC += source/firmware/kernel -include firmware/kernel/driver/driver.mk +include source/firmware/kernel/driver/driver.mk