This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
forked from 173210/valentine-hbl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.mk
80 lines (61 loc) · 1.76 KB
/
common.mk
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
CC := psp-gcc
AS := psp-as
FIXUP := psp-fixup-imports
PSPSDK := $(shell psp-config --pspsdk-path)
PRXEXPORTS := $(PSPSDK)/lib/prxexports.o
PRX_LDSCRIPT := -Wl,-T$(PSPSDK)/lib/linkfile.prx
INCDIR := -I$(PSPSDK)/include -Iinclude -I$(O)
LIBDIR := -L$(PSPSDK)/lib
CFLAGS := $(INCDIR) -G1 -Os -Werror -nostdlib -mno-abicalls -fno-pic -flto -std=c99
LDFLAGS := -G1 -Os -Werror -Wl,-q -nostdlib -mno-abicalls -fno-pic -flto -fwhole-program
ASFLAGS := $(INCDIR)
ifeq ($(EXPLOIT),launcher)
CFLAGS += -DLAUNCHER
endif
ifdef NID_DEBUG
DEBUG := 1
CFLAGS += -DNID_DEBUG
endif
ifdef DEBUG
CFLAGS += -DDEBUG
endif
ifdef NO_SYSCALL_RESOLVER
CFLAGS += -DNO_SYSCALL_RESOLVER
endif
OBJ_DEBUG := common/debug.o
OBJS_COMMON := common/utils/cache.o common/utils/fnt.o common/utils/scr.o \
common/utils/string.o common/memory.o common/prx.o common/utils.o
ifdef DEBUG
OBJS_COMMON += $(OBJ_DEBUG)
endif
ifdef NO_SYSCALL_RESOLVER
OBJS_COMMON += common/stubs/tables.o
else
OBJS_COMMON += common/stubs/syscall.o
endif
LIBS := -lpspaudio -lpspctrl -lpspdisplay -lpspge -lpsprtc -lpsputility
IMPORTS := $(O)/imports/imports.a
$(addprefix $(O_PRIV)/,$(OBJS_COMMON)): $(O)/config.h
$(IMPORTS): common/imports
$(MAKE) -C $< O=../../$(dir $@)
.PHONY: clean-imports
clean-imports:
rm -rf $(dir $(IMPORTS))
$(O)/%.PRX: $(O_PRIV)/%.elf
psp-prxgen $< $@
define COMPILE_C_RULE
$(COMPILE.c) $< $(OUTPUT_OPTION)
@$(COMPILE.c) -MM $< -MT $@ > $(O_PRIV)/.deps/$(basename $<).d
endef
$(O_PRIV)/%.o: %.c $(O)/config.h
$(COMPILE_C_RULE)
$(O_PRIV)/%.o: %.S $(O)/config.h
$(COMPILE_C_RULE)
$(O_PRIV)/%.o: %.s
$(COMPILE.s) $< $(OUTPUT_OPTION)
$(O)/config.h: include/exploits/$(EXPLOIT).h | $(O)/D
cp -f $< $@
DEPDIR = $(foreach f,$1,$(eval $f : | $(dir $f)D))
.PHONY:
%/D:
$(call Q,MKDIR,$(dir $@))mkdir -p $(dir $@)