-
Notifications
You must be signed in to change notification settings - Fork 51
/
Makefile.ps4
44 lines (33 loc) · 1.06 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
LIBPS4 := $(PS4SDK)/libPS4
CC := clang
AS := clang
LD := ld.gold
OBJCOPY := objcopy
ODIR := ps4build
SDIR := source
SDIR2 := source/ps4
IDIRS := -I. -Iinclude -I$(LIBPS4)/include
LDIRS := -L$(LIBPS4) -L. -Llib
CFLAGS := $(IDIRS) -std=gnu11 -fms-extensions -O2 -fPIC -ffreestanding -fno-builtin -Wall -masm=intel -target x86_64-scei-ps4-elf -m64 -mcmodel=large -DPS4
SFLAGS := -target x86_64-scei-ps4-elf
LFLAGS := $(LDIRS) -shared -fPIE
CFILES := $(wildcard $(SDIR)/*.c)
SFILES := $(wildcard $(SDIR)/*.s)
OBJS := $(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(patsubst $(SDIR2)/%.c, $(ODIR)/%.o, $(CFILES))) $(patsubst $(SDIR)/%.s, $(ODIR)/%.o, $(SFILES))
LIBS := -lPS4
TARGET = $(shell basename $(CURDIR))
#$(TARGET).bin: $(TARGET).elf
# $(OBJCOPY) -O binary $^ $@
$(TARGET).elf: $(ODIR) $(OBJS)
$(LD) $(ODIR)/*.o -o $@ $(LFLAGS) $(LIBS)
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/%.o: $(SDIR2)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/%.o: $(SDIR)/%.s
$(AS) -c -o $@ $< $(SFLAGS)
$(ODIR):
@mkdir $@
.PHONY: clean
clean:
rm -rf $(ODIR) $(TARGET) $(ODIR)/*.o