forked from gameblabla/handy-rs97
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.gcw0
executable file
·67 lines (54 loc) · 1.96 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
56
57
58
59
60
61
62
63
64
65
66
67
PRGNAME = handy
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
PORT = GCW0
SOUND_OUTPUT = alsa
PROFILE = APPLY
HUGE_PAGES = 1
SRCDIR = ./src/ ./src/gui/ ./src/handy-libretro src/ports ./src/ports/input/sdl src/sdlemu ./src/unzip
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
SRC_CP = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.cpp))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJ_CP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CP)))
OBJS = $(OBJ_C) $(OBJ_CP)
CFLAGS = -Ofast -fdata-sections -ffunction-sections -mno-fp-exceptions -mno-check-zero-division -fno-common -mframe-header-opt -flto -fsingle-precision-constant -march=mips32r2 -mtune=mips32r2
CFLAGS += -DWANT_CRC32 -DANSI_GCC -DSDL_PATCH -D$(PORT) -DOPENDINGUX_GCD_16PIXELS_ISSUE
CFLAGS += -I./src -I./src/handy-libretro -I./src/sdlemu -Isrc/ports -Isrc/ports/sound -Isrc/ports/sound -Isrc/ports/input/sdl
CFLAGS += -D$(PORT)
SRCDIR += ./src/ports/graphics/$(PORT)
SRCDIR += ./src/ports/sound/$(SOUND_OUTPUT)
ifeq ($(PROFILE), YES)
CFLAGS += -fprofile-generate=/usr/local/home
else ifeq ($(PROFILE), APPLY)
CFLAGS += -fprofile-use -fbranch-probabilities
endif
CXXFLAGS = $(CFLAGS)
ifeq ($(HUGE_PAGES), 0)
LDFLAGS = -nodefaultlibs
endif
LDFLAGS = -lc -lstdc++ -lgcc -lm -lSDL -lz -Wl,--as-needed -Wl,--gc-sections -s -flto
ifeq ($(HUGE_PAGES), 1)
LDFLAGS += -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs
endif
ifeq ($(SOUND_OUTPUT), portaudio)
LDFLAGS += -lportaudio
endif
ifeq ($(SOUND_OUTPUT), libao)
LDFLAGS += -lao
endif
ifeq ($(SOUND_OUTPUT), alsa)
LDFLAGS += -lasound
endif
# 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) -std=gnu99 -c -o $@ $<
$(OBJ_CP) : %.o : %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o