-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
100 lines (73 loc) · 3.02 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(PSL1GHT)),)
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
endif
include $(PSL1GHT)/ppu_rules
#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export DEPS := $(BASEDIR)/deps
export LIBS := $(BASEDIR)/lib
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LIBDIR := $(LIBS)/$(PLATFORM)
export DEPSDIR := $(DEPS)/$(PLATFORM)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
TARGET := build/libdbglogger
BUILD := build
SOURCE := source
INCLUDE := include
DATA := data
LIBS :=
MACHDEP := -DBIGENDIAN
CFLAGS += -O2 -Wall -mcpu=cell $(MACHDEP) -fno-strict-aliasing $(INCLUDES)
LD := ppu-ld
ifneq ($(BUILD),$(notdir $(CURDIR)))
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCE),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export BUILDDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(BUILDDIR)
CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin)))
VCGFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.vcg)))
VSAFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.vsa)))
export OFILES := $(CFILES:.c=.o) \
$(CXXFILES:.cpp=.o) \
$(SFILES:.S=.o) \
$(BINFILES:.bin=.bin.o) \
$(VCGFILES:.vcg=.vcg.o) \
$(VSAFILES:.vsa=.vsa.o)
export BINFILES := $(BINFILES:.bin=.bin.h)
export VCGFILES := $(VCGFILES:.vcg=.vcg.h)
export VSAFILES := $(VSAFILES:.vsa=.vsa.h)
export INCLUDES = $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
-I$(CURDIR)/$(BUILD) -I$(PSL1GHT)/ppu/include -I$(PORTLIBS)/include
.PHONY: $(BUILD) install clean shader
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
install: $(BUILD)
@echo Copying...
@cp -frv include/dbglogger.h $(PORTLIBS)/include
@cp -frv $(TARGET).a $(PORTLIBS)/lib
@echo Done!
clean:
@echo Clean...
@rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).self $(OUTPUT).a
else
DEPENDS := $(OFILES:.o=.d)
$(OUTPUT).a: $(OFILES)
$(OFILES): $(BINFILES) $(VCGFILES) $(VSAFILES)
-include $(DEPENDS)
endif