This repository has been archived by the owner on Dec 21, 2020. It is now read-only.
forked from danilolc/pk2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (44 loc) · 1.54 KB
/
Makefile
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#Make File
#-----------------
#"make" - Creates PK2 binary
#"make pk2le" - Creates PK2 Level Editor
#"make pk2sc" - Creates PK2 Sprite Creator
#"make clean" - Removes all objects, executables and dependencies
#-----------------
include config.txt
.PHONY: pk2 pk2le pk2sc clean makedirs
pk2: makedirs $(PK2_BIN)
pk2le: makedirs $(PK2_LE_BIN)
pk2sc: makedirs $(PK2_SC_BIN)
###########################
#Rules for generate the binaries using the object files
$(PK2_BIN): $(PK2_OBJ) $(PK2_SPRITE_OBJ) $(PK2_MAP_OBJ) $(ENGINE_OBJ)
@echo -Linking PK2
@$(CPP) $^ $(LFLAGS) -o $@
@cp $@ $(RES_DIR)$(GAME_NAME).exe
$(PK2_LE_BIN): $(PK2_LE_OBJ) $(PK2_SPRITE_OBJ) $(PK2_MAP_OBJ) $(ENGINE_OBJ)
@echo -Linking PK2_LE
@$(CPP) $^ $(LFLAGS) -o $@
#TODO - Don't compile with $(ENGINE_OBJ) and $(LFLAGS)
$(PK2_SC_BIN): $(PK2_SC_OBJ) $(PK2_SPRITE_OBJ) $(ENGINE_OBJ)
@echo -Linking PK2_SC
@$(CPP) $^ $(LFLAGS) -o $@
###########################
###########################
#Rules for generate any *.o file
-include $(DEPENDENCIES)
build/%.o : engine/%.cpp
@echo -Some dependence of $@ was changed, updating
@$(CPP) $(CFLAGS) -I$(ENGINE_DIR) -o $@ -c $<
@$(CPP) -MM -MT $@ -I$(ENGINE_DIR) $< > $(BUILD_DIR)$*.d
build/%.o : src/%.cpp
@echo -Some dependence of $@ was changed, updating
@$(CPP) $(CFLAGS) -I$(SRC_DIR) -I$(ENGINE_DIR) -o $@ -c $<
@$(CPP) -MM -MT $@ -I$(SRC_DIR) -I$(ENGINE_DIR) $< > $(BUILD_DIR)$*.d
###########################
clean:
@rm -f -r $(BIN_DIR)
@rm -f -r $(BUILD_DIR)
makedirs:
@mkdir -p $(BIN_DIR) >/dev/null
@mkdir -p $(BUILD_DIR) >/dev/null