-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.PS4
88 lines (66 loc) · 2.79 KB
/
Makefile.PS4
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
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(OO_PS4_TOOLCHAIN)),)
$(error "Please set OO_PS4_TOOLCHAIN in your environment. export OO_PS4_TOOLCHAIN=<path>")
endif
include $(OO_PS4_TOOLCHAIN)/build_rules.mk
#---------------------------------------------------------------------------------
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-ps4/libdbglogger
BUILD := build-ps4
SOURCE := source
INCLUDE := include
DATA := data
LIBS :=
CFLAGS += --target=x86_64-pc-freebsd12-elf -fPIC -funwind-tables -c $(EXTRAFLAGS) -isysroot $(OO_PS4_TOOLCHAIN) -isystem $(OO_PS4_TOOLCHAIN)/include $(INCLUDES) -D__PS4__
CXXFLAGS += $(CFLAGS) -isystem $(OO_PS4_TOOLCHAIN)/include/c++/v1
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)))
export OFILES := $(CFILES:.c=.o) \
$(CXXFILES:.cpp=.o) \
$(SFILES:.S=.o) \
$(BINFILES:.bin=.bin.o)
export BINFILES := $(BINFILES:.bin=.bin.h)
export INCLUDES = $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
-I$(CURDIR)/$(BUILD) -I$(OO_PS4_TOOLCHAIN)/include
.PHONY: $(BUILD) install clean
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.PS4
install: $(BUILD)
@echo Copying...
@cp -frv include/dbglogger.h $(OO_PS4_TOOLCHAIN)/include
@cp -frv $(TARGET).a $(OO_PS4_TOOLCHAIN)/lib
@echo lib installed!
clean:
@echo Clean...
@rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).self $(OUTPUT).a
else
DEPENDS := $(OFILES:.o=.d)
$(OUTPUT).a: $(OFILES)
$(OFILES): $(BINFILES)
-include $(DEPENDS)
endif