-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.gcw
executable file
·29 lines (21 loc) · 1.03 KB
/
Makefile.gcw
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
PRGNAME = game.elf
CC = /opt/gcw0-toolchain/bin/mipsel-linux-gcc
RESOURCE_FOLDER = data/
SRCDIR = src
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJS = $(OBJ_C)
CFLAGS = -Ofast -mno-shared -mplt -fdata-sections -ffunction-sections -mframe-header-opt -mno-fp-exceptions -mno-check-zero-division -fsingle-precision-constant -fno-common -march=mips32r2 -mtune=mips32r2 -fipa-pta -flto -Isrc -I.
CFLAGS += -DGCW0 -DLINUX
CXXFLAGS = $(CFLAGS)
LDFLAGS = -nodefaultlibs -lc -lgcc -lm -lSDL -lSDL_mixer -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-O1,--sort-common,--as-needed,--gc-sections -flto -no-pie -s
LDFLAGS += -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs
# Rules to make executable
$(PRGNAME): $(OBJS)
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
/opt/gcw0-toolchain/bin/hugeedit --text --data $(PRGNAME)
$(OBJ_C) : %.o : %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o *.elf *.opk