-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.eeglobal
78 lines (57 loc) · 2.56 KB
/
Makefile.eeglobal
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
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id$
# Include directories
EE_INCS := -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include -I. $(EE_INCS)
# C compiler flags
EE_CFLAGS := -D_EE -O2 -G0 -Wall $(EE_CFLAGS)
# C++ compiler flags
EE_CXXFLAGS := -D_EE -O2 -G0 -Wall $(EE_CXXFLAGS)
# Linker flags
EE_LDFLAGS := -L$(PS2SDK)/ee/lib $(EE_LDFLAGS)
# Assembler flags
EE_ASFLAGS := -G0 $(EE_ASFLAGS)
# Link with following libraries. This is a special case, and instead of
# allowing the user to override the library order, we always make sure
# libkernel is the last library to be linked.
EE_LIBS += -lc -lkernel
# Externally defined variables: EE_BIN, EE_OBJS, EE_LIB
# These macros can be used to simplify certain build rules.
EE_C_COMPILE = $(EE_CC) $(EE_CFLAGS) $(EE_INCS)
EE_CXX_COMPILE = $(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS)
%.o : %.c
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
%.o : %.cc
$(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) -c $< -o $@
%.o : %.cpp
$(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) -c $< -o $@
%.o : %.S
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
%.o : %.s
$(EE_AS) $(EE_ASFLAGS) $< -o $@
$(EE_BIN) : $(EE_OBJS) $(PS2SDK)/ee/startup/crt0.o
$(EE_CC) -mno-crt0 -T$(PS2SDK)/ee/startup/linkfile $(EE_CFLAGS) \
-o $(EE_BIN) $(PS2SDK)/ee/startup/crt0.o $(EE_OBJS) $(EE_LDFLAGS) $(EE_LIBS)
$(EE_ERL) : $(EE_OBJS)
$(EE_CC) -mno-crt0 -o $(EE_ERL) $(EE_OBJS) $(EE_CFLAGS) $(EE_LDFLAGS) -Wl,-r -Wl,-d
$(EE_STRIP) --strip-unneeded -R .mdebug.eabi64 -R .reginfo -R .comment $(EE_ERL)
$(EE_LIB) : $(EE_OBJS)
$(EE_AR) cru $(EE_LIB) $(EE_OBJS)
$(EE_CXX_LIB) : $(EE_CXX_OBJS)
$(EE_AR) cru $(EE_CXX_LIB) $(EE_CXX_OBJS)
# C compile test
TEST_LIBS += -lc -lkernel
$(TEST_BIN) : $(TEST_OBJS) $(PS2SDK)/ee/startup/crt0.o
$(EE_CC) -mno-crt0 -T$(PS2SDK)/ee/startup/linkfile $(EE_CFLAGS) \
-o $(TEST_BIN) $(PS2SDK)/ee/startup/crt0.o $(TEST_OBJS) $(EE_LDFLAGS) $(TEST_LIBS)
# C++ compile test
TEST_CXX_LIBS += -lstdc++ $(PS2SDK)/ee/lib/libc.a $(PS2DEV)/ee/ee/lib/libc.a -Wl,--whole-archive -lkernel -Wl,--no-whole-archive
$(TEST_CXX_BIN) : $(TEST_CXX_OBJS) $(PS2SDK)/ee/startup/crt0.o
$(EE_CXX) -mno-crt0 -T$(PS2SDK)/ee/startup/linkfile $(EE_CXXFLAGS) \
-o $(TEST_CXX_BIN) $(PS2SDK)/ee/startup/crt0.o $(TEST_CXX_OBJS) $(EE_LDFLAGS) $(TEST_CXX_LIBS)