2016-07-28 19:02:54 +00:00
|
|
|
##############################################################
|
|
|
|
#
|
|
|
|
##############################################################
|
|
|
|
|
2016-07-29 06:37:13 +00:00
|
|
|
include config/make/rules.mk
|
2016-07-28 19:02:54 +00:00
|
|
|
|
|
|
|
OS_NAME = kosmos
|
|
|
|
|
|
|
|
MAINFILE = $(EXE_DIR)/lib$(OS_NAME)-$(ARCH)-$(BOARD)$(DBG_EXT)$(LIB_EXT)
|
2016-08-01 11:34:25 +00:00
|
|
|
DEPLOY_PACKET = lib$(OS_NAME)-$(ARCH)-$(BOARD)-$()$(DBG_EXT).tar.gz
|
2016-07-28 19:02:54 +00:00
|
|
|
|
|
|
|
INCLUDES += $(SRC_DIR)
|
|
|
|
|
|
|
|
SUB_FOLDER :=
|
|
|
|
CHECK_FOLDER :=
|
|
|
|
SOURCES := $(wildcard $(SRC_DIR)/*.c)
|
|
|
|
ASM_SOURCES := $(wildcard $(SRC_DIR)/*.s)
|
|
|
|
|
2016-07-29 06:37:13 +00:00
|
|
|
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)
|
2016-07-28 19:02:54 +00:00
|
|
|
|
|
|
|
#include subfolders
|
2016-07-29 06:37:13 +00:00
|
|
|
include source/firmware/firmware.mk
|
2016-07-28 19:02:54 +00:00
|
|
|
|
2016-07-29 06:37:13 +00:00
|
|
|
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))
|
2016-07-28 19:02:54 +00:00
|
|
|
|
|
|
|
all: check $(MAINFILE)
|
|
|
|
|
|
|
|
deploy: all
|
2016-08-01 11:34:25 +00:00
|
|
|
echo $(SW_KERNEL)
|
|
|
|
echo $(SW_MAJOR)
|
|
|
|
echo $(SW_MINOR)
|
2016-07-28 19:02:54 +00:00
|
|
|
@$(MKDIR) $(EXE_DIR)/include
|
|
|
|
$(SRC_DIR)/scripts/board_interface.py -b "$(SRC_DIR)/firmware/arch/$(CPU)/board/$(BOARD)/include/$(BOARD).h" -o "$(EXE_DIR)/include/board_devices.h"
|
|
|
|
$(SRC_DIR)/scripts/stack_interface.py -i "$(SRC_DIR)/firmware/arch/$(CPU)/include/$(CPU)_stack.h" -o "$(EXE_DIR)/include/stack.h"
|
|
|
|
cp $(SRC_DIR)/firmware/kernel/interface/*.* $(EXE_DIR)/include/
|
|
|
|
|
|
|
|
check:
|
2016-07-29 06:37:13 +00:00
|
|
|
echo $(CHECK_FOLDER)
|
|
|
|
echo $(CHECKSOURCES)
|
2016-07-28 19:02:54 +00:00
|
|
|
$(CPPCHECK) $(CPPCHECK_FLAGS) $(CHECKSOURCES)
|
|
|
|
|
|
|
|
|
|
|
|
$(MAINFILE): $(OBJECTS) $(ASM_OBJECTS)
|
|
|
|
@$(MKDIR) $(EXE_DIR)
|
|
|
|
$(AR) rcs $(MAINFILE) $(OBJECTS) $(ASM_OBJECTS)
|
|
|
|
|
2016-07-29 06:37:13 +00:00
|
|
|
$(OBJ_DIR)/%.o: $(ROOT_DIR)/%.c
|
2016-07-28 19:02:54 +00:00
|
|
|
@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 $@
|
|
|
|
|
2016-07-29 06:37:13 +00:00
|
|
|
$(OBJ_DIR)/%.o: $(ROOT_DIR)/%.s
|
2016-07-28 19:02:54 +00:00
|
|
|
@$(MKDIR) $(OBJ_DIR)
|
|
|
|
@$(foreach folder, $(SUB_FOLDER), $(shell mkdir -p $(OBJ_DIR)/$(folder)))
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
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 \
|
2016-07-29 06:37:13 +00:00
|
|
|
$(EXE_DIR)/include/* \
|
2016-07-28 19:02:54 +00:00
|
|
|
$(OBJ_DIR)/*.d \
|
|
|
|
$(MAINFILE)
|
|
|
|
|
|
|
|
distclean:
|
|
|
|
-rm -rf $(ROOT_DIR)/release
|
|
|
|
|
|
|
|
doc:
|
|
|
|
@$(MKDIR) $(DOC_DIR)
|
|
|
|
(cat $(DOXYFILE) ; echo "INPUT=$(DOC_SRC)" ; echo "OUTPUT_DIRECTORY=$(DOC_DIR)") | doxygen -
|
|
|
|
|
|
|
|
ifneq "$(MAKECMDGOALS)" "clean"
|
|
|
|
-include $(DEPS)
|
|
|
|
else
|
|
|
|
ifneq "$(MAKECMDGOALS)" "distclean"
|
|
|
|
-include $(DEPS)
|
|
|
|
endif
|
|
|
|
endif
|