Environment variable
[ps4-sdk.git] / examples / hello / Makefile
blob85ea0a8135206519d44b1174f37c5b5bfe3edb85
1 TEXT := 0x926200000
2 DATA := 0x926300000
4 CC := gcc
5 AS := gcc
6 OBJCOPY := objcopy
7 ODIR := build
8 SDIR := source
9 IDIRS := -I. -I$(PS4_SDK)/include -Iinclude
10 LDIRS := -L. -L$(PS4_SDK)/ -Llib
11 CFLAGS := $(IDIRS) -O2 -fno-builtin -nostartfiles -nostdlib -Wall -masm=intel -march=btver2 -mtune=btver2 -m64 -mabi=sysv -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))
22 $(TARGET): $(ODIR) $(OBJS)
23 $(CC) $(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