-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.lepus
78 lines (59 loc) · 2.78 KB
/
Makefile.lepus
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
PRGNAME = vb.elf
CC = /opt/lepus-toolchain/bin/mipsel-linux-gcc
#### Configuration
# Possible values : retrostone, rs97, rs90
PORT = gcw0
# Possible values : alsa, oss, portaudio
SOUND_ENGINE = sdl
PROFILE = 0
HUGE_PAGES = 1
#### End of Configuration
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
INCLUDES = -Ilibretro-common/include -Isrc
INCLUDES += -Ishell/headers -Ishell/video/$(PORT) -Ishell/audio -Ishell/scalers -Ishell/input/sdl -Ishell/fonts -Ishell/menu
INCLUDES += -Imednafen -I./mednafen/vb -I./mednafen/sound -I. -Ishell/emu -Imednafen/include -Ishell/input -Imednafen/video
DEFINES = -DLSB_FIRST -DINLINE="inline" -DINLINE="inline" -DNDEBUG -DWANT_STEREO_SOUND -DFASTBUILD -DGCW0 -DFRAMESKIP
DEFINES += -DMEDNAFEN_VERSION_NUMERIC=931
DEFINES += -DWANT_16BPP -DFRONTEND_SUPPORTS_RGB565 -DENABLE_JOYSTICKCODE
CFLAGS = -Wall -Wextra -Ofast -fdata-sections -ffunction-sections -fsection-anchors -fno-builtin -mplt -mframe-header-opt -mno-fp-exceptions -mno-check-zero-division -fsingle-precision-constant -fno-common -march=mips32r2 -mtune=mips32r2 -flto -fno-PIC -mno-shared
CFLAGS += $(INCLUDES) $(DEFINES)
CFLAGS += -mlong32 -mno-xgot -fsection-anchors -fno-builtin
CFLAGS += -fno-math-errno -fgcse-las -fgcse-sm -fmerge-all-constants -fno-ident -fno-stack-protector -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables
CFLAGS += -freorder-functions
CFLAGS += -fipa-pta -fsection-anchors -fdelete-dead-exceptions -freorder-functions
ifeq ($(PROFILE), YES)
CFLAGS += -fprofile-generate=/usr/local/home
else ifeq ($(PROFILE), APPLY)
CFLAGS += -fprofile-use -fbranch-probabilities
endif
LDFLAGS = -nodefaultlibs -lc -lgcc -lm -lSDL -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-O1,--sort-common,--as-needed,--gc-sections -flto -no-pie -s
ifeq ($(SOUND_ENGINE), alsa)
LDFLAGS += -lasound
endif
ifeq ($(SOUND_ENGINE), portaudio)
LDFLAGS += -lasound -lportaudio
endif
ifeq ($(HUGE_PAGES), 1)
LDFLAGS += -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs
endif
ifeq ($(PROFILE), YES)
LDFLAGS += -lgcov
endif
# Files to be compiled
SRCDIR = ./src ./shell ./shell/scalers ./shell/emu ./shell/menu
SRCDIR += ./shell/input/sdl/ ./shell/video/$(PORT) ./shell/audio/$(SOUND_ENGINE)
SRCDIR += ./mednafen ./mednafen/vb ./mednafen/sound ./mednafen/hw_cpu/v810 ./mednafen/hw_cpu/v810/fpu-new
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJS = $(OBJ_C) $(OBJ_CPP)
# Rules to make executable
$(PRGNAME): $(OBJS)
$(CC) $(CFLAGS) -std=gnu99 -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