aboutsummaryrefslogtreecommitdiff
path: root/port/vita/rules.mk
blob: a914195c40569913b3e476f032cc4c21c3421051 (plain)
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
TITLE   := picow
TITLEID := PICO00008

# Some magic flags:
# - `-mcpu=cortext-a9`: specifically target the PS Vita CPU which may
#   help with some optimizations (instead of generic `armv7`).
# - `-Wl,-q`: make the ELF file relocatable which is required for the
#   executable to run (otherwise it crashes on startup).
# - `-Wl,--defsym=__sce_headroom=0x10000`: add some extra space for
#   the code segment, otherwise linking fails sporadically.
# - `-lScePower_stub`: link in the power management library to allow us
#   to overclock the PS Vita for performance
CFLAGS  += -mcpu=cortex-a9
LDFLAGS += -Wl,-q -Wl,--defsym=__sce_headroom=0x10000 -lScePower_stub

port: $(TARGET)/picow.vpk

$(TARGET)/picow.vpk: $(TARGET)/eboot.bin $(TARGET)/param.sfo
	vita-pack-vpk -s $(TARGET)/param.sfo -b $(TARGET)/eboot.bin $@

$(TARGET)/eboot.bin: $(TARGET)/picow.velf
	vita-make-fself -s $(TARGET)/picow.velf $@

$(TARGET)/param.sfo:
	vita-mksfoex -s TITLE_ID=$(TITLEID) "PICO-w" $@

$(TARGET)/picow.velf: $(TARGET)/picow.elf
	vita-elf-create $(TARGET)/picow.elf $@

$(TARGET)/picow.elf: $(OBJ) $(OUT)/port/vita/src/vita.o
	@ echo "CC\t$@"
	@ $(CC) $^ -o $@ $(LDFLAGS)

$(OUT)/port/vita/src/vita.o: port/vita/src/vita.c
	@ echo "CC\t$@"
	@ mkdir -p $(dir $@)
	@ $(CC) $(CFLAGS) -c $< -o $@