-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.gcw0
55 lines (44 loc) · 1.8 KB
/
Makefile.gcw0
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
45
46
47
48
49
50
51
52
53
54
55
PRGNAME = swanemu
CC = /opt/gcw0-toolchain/bin/mipsel-linux-gcc
PORT = gcw0
SOUND_ENGINE = alsa
PROFILE = 0
HUGE_PAGES = 1
# change compilation / linking flag options
INCLUDES = -Ishell/input/sdl -Icore -Icore/sound -Ishell/menu -Ishell/video/$(PORT) -Ishell/audio -Ishell/scalers -Ishell/headers
DEFINES = -DLSB_FIRST -DINLINE="inline" -DWANT_16BPP -DFRONTEND_SUPPORTS_RGB565 -DSUPPORT_NATIVE_RESOLUTION
DEFINES += -DALSA_SOUND -DIPU_SCALE -DENABLE_JOYSTICKCODE
CFLAGS = $(INCLUDES) $(DEFINES)
CFLAGS += -std=gnu99
#-fdata-sections -ffunction-sections
CFLAGS += -Ofast -mno-fp-exceptions -mno-check-zero-division -mframe-header-opt -fsingle-precision-constant -fno-common -march=mips32r2 -mtune=mips32r2
CFLAGS += -fno-builtin -march=mips32r2 -mtune=mips32r2 -flto -fno-common -mplt -mno-shared
ifeq ($(PROFILE), 1)
CFLAGS += -fprofile-generate=/media/data/local/home/
else ifeq ($(PROFILE), 2)
CFLAGS += -fprofile-use -fbranch-probabilities
endif
LDFLAGS = -lc -lm -lgcc -lasound -lSDL -Wl,--as-needed -Wl,--gc-sections -flto -fuse-linker-plugin -no-pie -s
ifeq ($(PROFILE), 1)
LDFLAGS += -lgcov
endif
ifeq ($(HUGE_PAGES), 1)
LDFLAGS += -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs
endif
# Files to be compiled
SRCDIR = ./core ./core/sound ./core/wswan
SRCDIR += ./shell/video/$(PORT) ./shell/audio/$(SOUND_ENGINE) ./shell/input/sdl ./shell/menu ./shell/emu ./shell/scalers
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJS = $(OBJ_C)
# Rules to make executable
$(PRGNAME): $(OBJS)
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
ifeq ($(HUGE_PAGES), 1)
hugeedit --text --data $(PRGNAME)
endif
$(OBJ_C) : %.o : %.c
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f $(PRGNAME)$(EXESUFFIX) *.o