-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
86 lines (60 loc) · 1.93 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# ------------
DEBUG ?= 0
BASENAME = BGDA_123
# OPL needs this to look like a sony binary
EE_BIN = fs/$(BASENAME).00
EE_SRC_DIR = src/
EE_SRC_AD_DIR = src/animDebug/
EE_SRC_PS2_DIR = src/ps2/
EE_OBJS_DIR = obj/
EE_OBJS_AD_DIR = obj/animDebug/
EE_OBJS_PS2_DIR = obj/ps2/
MAPFILE = fs/$(BASENAME).MAP
EE_LDFLAGS += -Wl,-Map,$(MAPFILE)
EE_LIBS = -lpad -lgs -ldma -lc
ifeq ($(DEBUG),1)
EE_OPTFLAGS = -O0
EE_CFLAGS += -D__DEBUG -g
else
EE_OPTFLAGS = -O2
endif
MAIN_OBJS = matrix
PS2_OBJS = display dlist draw elfData filesys font frameFunctions \
GIFTag gsAllocator \
levelLoop lump main menu model pad scene showLanguageMenu state \
TexDecoder text texture trace vifMesh
ANIMDEBUG_OBJS = animDebugSetup animMenuDraw
MAIN_OBJS := $(MAIN_OBJS:%=$(EE_OBJS_DIR)%.o)
ANIMDEBUG_OBJS := $(ANIMDEBUG_OBJS:%=$(EE_OBJS_AD_DIR)%.o)
PS2_OBJS := $(PS2_OBJS:%=$(EE_OBJS_PS2_DIR)%.o)
# Generate .d files to track header file dependencies of each object file
EE_CFLAGS += -MMD -MP -Isrc -Isrc/ps2/hw
EE_OBJS += $(MAIN_OBJS) $(PS2_OBJS) $(ANIMDEBUG_OBJS)
EE_DEPS = $($(filter %.o,$(EE_OBJS)):%.o=%.d)
.PHONY: all release debug rebuild iso elf
all: $(EE_BIN) iso
elf: $(EE_BIN)
debug:
$(MAKE) DEBUG=1 all
clean:
echo "Cleaning..."
rm -fr $(MAPFILE) $(EE_BIN) $(EE_OBJS_DIR) $(BASENAME).ISO
rebuild: clean all
iso: $(BIN_TARGET)
mkisofs -o $(BASENAME).ISO ./fs
$(EE_OBJS_DIR):
@mkdir -p $(EE_OBJS_PS2_DIR)
@mkdir -p $(EE_OBJS_AD_DIR)
$(EE_OBJS_DIR)%.o: $(EE_SRC_DIR)%.cpp | $(EE_OBJS_DIR)
$(EE_CXX) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(EE_OBJS_AD_DIR)%.o: $(EE_SRC_AD_DIR)%.cpp | $(EE_OBJS_DIR)
$(EE_CXX) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(EE_OBJS_PS2_DIR)%.o: $(EE_SRC_PS2_DIR)%.cpp | $(EE_OBJS_DIR)
$(EE_CXX) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
ifndef PS2SDK
ps2sdk-not-setup:
@echo "PS2SDK is not setup. Please setup PS2SDK before building this project"
endif
include make/Makefile.pref
include make/Makefile.eeglobal_cpp
-include $(EE_DEPS)