-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·104 lines (77 loc) · 3.74 KB
/
Makefile
File metadata and controls
executable file
·104 lines (77 loc) · 3.74 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif
include $(PSL1GHT)/ppu_rules
BUILD := build
SOURCES := src .
INCLUDES := .
#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export DEPS := $(BASEDIR)/deps
export LIBS := $(BASEDIR)/lib
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
export sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
export SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
-I$(BASEDIR)/../../include
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LIBDIR := $(LIBS)/$(PLATFORM)
export DEPSDIR := $(DEPS)/$(PLATFORM)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
LD := $(PREFIX)ld
FSELF := fself.py
CFLAGS := -O2 -mregnames -Wall -mcpu=cell $(MACHDEP) $(INCLUDE) -Wa,-mcell
ASFLAGS := $(MACHDEP) -mregnames -mcpu=cell -D__ASSEMBLY__ -Wa,-mcell $(INCLUDE)
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
all: ppu
#---------------------------------------------------------------------------------
ppu:
#---------------------------------------------------------------------------------
@[ -d $(LIBS)/ppu ] || mkdir -p $(LIBS)/ppu
@[ -d $(DEPS)/ppu ] || mkdir -p $(DEPS)/ppu
@[ -d ppu ] || mkdir -p ppu
@$(MAKE) PLATFORM=ppu lib -C ppu -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
install: all
#---------------------------------------------------------------------------------
@[ -d $(PSL1GHT)/ppu/lib ] || mkdir -p $(PSL1GHT)/ppu/lib
@cp -frv $(CURDIR)/lib/ppu/*.a $(PSL1GHT)/ppu/lib
#---------------------------------------------------------------------------------
.PHONY: lib ppu install
#---------------------------------------------------------------------------------
lib: SNMAPI.sprx
#---------------------------------------------------------------------------------
libexport.o: src/libexport.c
@$(CC) $(DEPSOPT) -S -m32 $(INCLUDE) $< -o libexport.S
@$(CC) $(DEPSOPT) -c libexport.S -o $@
SNMAPI.prx: exports.o libexport.o
@$(LD) -r exports.o libexport.o -o $@
SNMAPI.sprx: SNMAPI.prx
@$(FSELF) SNMAPI.prx SNMAPI.sprx
cp SNMAPI.sprx ../SNMAPI.sprx
#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
@echo clean ...
@rm -rf ppu
@rm -rf $(DEPS)
@rm -rf $(LIBS)
-include $(DEPSDIR)/*.d