-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile.rs90
executable file
·60 lines (48 loc) · 1.81 KB
/
Makefile.rs90
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
PRGNAME = handy
CC = /opt/rs90-toolchain/bin/mipsel-linux-gcc
CXX = /opt/rs90-toolchain/bin/mipsel-linux-g++
PORT = RS90
SOUND_OUTPUT = alsa
PROFILE = APPLY
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 -mframe-header-opt -fno-common -flto -fsingle-precision-constant -march=mips32 -mtune=mips32 -mplt
CFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 -falign-labels=1
CFLAGS += -DWANT_CRC32 -DANSI_GCC -DSDL_PATCH
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="/media/data/local/home"
else ifeq ($(PROFILE), APPLY)
CFLAGS += -fprofile-use -fbranch-probabilities
endif
CXXFLAGS = $(CFLAGS) -fpermissive
LDFLAGS = -lc -lgcc -lstdc++ -lm -lSDL -lz -no-pie -Wl,--as-needed -Wl,--gc-sections -s -flto
ifeq ($(PROFILE), YES)
LDFLAGS += -lgcov
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)
$(OBJ_C) : %.o : %.c
$(CC) $(CFLAGS) -c -o $@ $<
$(OBJ_CP) : %.o : %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o