Update README.md
[ps4-sdk.git] / examples / threads / Makefile
blobd04fcc7484ec9f2a9cadcf986ba3d4d54057853a
1 TEXT := 0x926200000
2 DATA := 0x926300000
4 CC := gcc
5 AS := gcc
6 OBJCOPY := objcopy
7 ODIR := build
8 SDIR := source
9 IDIRS := -I$(PS4SDK)/include -I. -Iinclude
10 LDIRS := -L$(PS4SDK) -L. -Llib
11 CFLAGS := $(IDIRS) -O2 -fno-builtin -nostartfiles -nostdlib -Wall -masm=intel -march=btver2 -mtune=btver2 -m64 -mabi=sysv -mcmodel=large -DTEXT_ADDRESS=$(TEXT) -DDATA_ADDRESS=$(DATA)
12 SFLAGS := -nostartfiles -nostdlib -march=btver2 -mtune=btver2
13 LFLAGS := $(LDIRS) -Ttext=$(TEXT) -Tdata=$(DATA)
14 CFILES := $(wildcard $(SDIR)/*.c)
15 SFILES := $(wildcard $(SDIR)/*.s)
16 OBJS := $(patsubst $(SDIR)/%.c, build/%.o, $(CFILES)) $(patsubst $(SDIR)/%.s, build/%.o, $(SFILES))
18 LIBS := -lPS4-SDK
20 TARGET = $(shell basename $(CURDIR)).bin
22 $(TARGET): $(ODIR) $(OBJS)
23 $(CC) $(PS4SDK)/crt0.s $(ODIR)/*.o -o temp.t $(CFLAGS) $(LFLAGS) $(LIBS)
24 $(OBJCOPY) -O binary temp.t $(TARGET)
25 rm -f temp.t
27 $(ODIR)/%.o: $(SDIR)/%.c
28 $(CC) -c -o $@ $< $(CFLAGS)
30 $(ODIR)/%.o: $(SDIR)/%.s
31 $(AS) -c -o $@ $< $(SFLAGS)
33 $(ODIR):
34 @mkdir $@
36 .PHONY: clean
38 clean:
39 rm -f $(TARGET) $(ODIR)/*.o