-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
31 lines (24 loc) · 829 Bytes
/
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
CC := gcc-9
AS := gcc-9
ODIR := build
SDIR := source
IDIRS := -I. -Iinclude
LDIRS := -L. -Llib
CFLAGS := $(IDIRS) -fno-builtin -nostdlib -Wall -m64 -fPIC -mcmodel=small
SFLAGS := -fno-builtin -nostartfiles -nostdlib -fPIC -mcmodel=small
LFLAGS := $(LDIRS) -Xlinker -T linker.x -Wl,--build-id=none
CFILES := $(wildcard $(SDIR)/*.c)
SFILES := $(wildcard $(SDIR)/*.s)
OBJS := $(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(CFILES)) $(patsubst $(SDIR)/%.s, $(ODIR)/%.o, $(SFILES))
TARGET = ps5_pup_decrypt.elf
$(TARGET): $(ODIR) $(OBJS)
$(CC) crt0.s $(ODIR)/*.o -o $(TARGET) $(CFLAGS) $(LFLAGS)
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/%.o: $(SDIR)/%.s
$(AS) -c -o $@ $< $(SFLAGS)
$(ODIR):
@mkdir $@
.PHONY: clean
clean:
rm -f $(shell basename $(CURDIR)).elf $(TARGET) $(ODIR)/*.o