-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile-preprocess
40 lines (28 loc) · 2 KB
/
makefile-preprocess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Engine name
override ENGINE_NAME = core
# Engine's home
override ENGINE_HOME = $(ENGINE_FOLDER)
# List of header files.
HEADERS_DIRS = $(shell find $(MY_HOME)/source -type d -print)
HEADERS_DIRS := $(HEADERS_DIRS) $(shell find $(MY_HOME)/headers -type d -print)
HEADERS_DIRS_CLEAN = $(shell echo $(HEADERS_DIRS) | sed -e 's@'"$(MY_HOME)"/'@@g')
HEADERS = $(foreach DIR,$(HEADERS_DIRS),$(wildcard $(DIR)/*.h))
# Makes a list of the header files that will have to be created.
WORKING_FOLDER_CLEAR = $(GAME_HOME)/$(shell echo $(WORKING_FOLDER) | sed -e 's@'"$(GAME_HOME)"/'@@g')
H_FILES_TEMP = $(shell echo $(HEADERS) | sed -e 's@'"$(WORKING_FOLDER)"/'@@g' -e 's@'"$(MY_HOME)"/'@@g')
H_FILES = $(addprefix $(WORKING_FOLDER_CLEAR)/headers/$(NAME)/, $(H_FILES_TEMP:.h=.h))
D_FILES = $(shell if [ -d $(WORKING_FOLDER)/classes/dependencies/$(NAME) ]; then find $(WORKING_FOLDER)/classes/dependencies/$(NAME) -name "*.d"; fi; )
# Class setup file
SETUP_CLASSES = $(BASENAME)SetupClasses
SETUP_CLASSES_SOURCE = $(WORKING_FOLDER)/objects/$(BUILD_MODE)/$(NAME)/$(SETUP_CLASSES)
preprocess: phony $(SETUP_CLASSES_SOURCE).c
@$(shell echo "$(D_FILES)" > $(WORKING_FOLDER)/classes/dependencies/$(BASENAME).dependencies.txt )
PLUGINS_ARGUMENT=$(addprefix -l , $(PLUGINS:.=.))
# Override makefile's below dependencies for header files so proper propagation of changes in base classes are catched up
-include $(D_FILES)
$(WORKING_FOLDER_CLEAR)/headers/$(NAME)/%.h: $(MY_HOME)/%.h
@bash $(ENGINE_HOME)/lib/compiler/preprocessor/processHeaderFile.sh -e $(ENGINE_HOME) -i $< -o $@ -m $(GAME_HOME) -w $(WORKING_FOLDER) -c $(CLASSES_HIERARCHY_FILE) -n $(NAME) -h $(MY_HOME) -p $(PLUGINS_FOLDER) -u $(USER_PLUGINS_FOLDER) -g makefile -x $(GAME_NAME) $(PLUGINS_ARGUMENT)
$(SETUP_CLASSES_SOURCE).c: $(H_FILES)
@bash $(ENGINE_HOME)/lib/compiler/preprocessor/setupClasses.sh -n $(SETUP_CLASSES) -c $(CLASSES_HIERARCHY_FILE) -o $(SETUP_CLASSES_SOURCE).c -w $(WORKING_FOLDER) -b $(BUILD_MODE)
phony:
@echo > /dev/null