aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorm45t3r2020-11-12 00:20:16 -0300
committerm45t3r2020-11-12 00:30:01 -0300
commitae24fbb08e49a2b39887c83fc9c5974606453a35 (patch)
treeb3b623247447e0c6649edf450fb038e35edfa832
parentb573d4ac1108e58b367127780a30c3d50d2523a9 (diff)
downloadsnesemu-ae24fbb08e49a2b39887c83fc9c5974606453a35.tar.gz
snesemu-ae24fbb08e49a2b39887c83fc9c5974606453a35.tar.bz2
snesemu-ae24fbb08e49a2b39887c83fc9c5974606453a35.zip
Add Makefile.gcw0
-rw-r--r--Makefile.gcw073
1 files changed, 73 insertions, 0 deletions
diff --git a/Makefile.gcw0 b/Makefile.gcw0
new file mode 100644
index 0000000..d368aa5
--- /dev/null
+++ b/Makefile.gcw0
@@ -0,0 +1,73 @@
+GIT_VERSION := "$(shell git describe --abbrev=7 --dirty --always)"
+
+PRGNAME = snes9x
+
+VIDEO_BACKEND = sdl
+INPUT_BACKEND = sdl
+SOUND_BACKEND = alsa
+
+PREFIX = mipsel-linux
+
+# define regarding OS, which compiler to use
+CC = $(PREFIX)-gcc
+STRIP = $(PREFIX)-strip
+AS = $(PREFIX)-as
+GASM = $(PREFIX)-g++
+
+SYSROOT := $(shell $(CC) --print-sysroot)
+SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
+SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs)
+
+# change compilation / linking flag options
+CFLAGS = -DLSB_FIRST -I. -Ilibretro-common/include -Isrc -DINLINE="inline" -DRIGHTSHIFT_IS_SAR
+CFLAGS += -Isource -I./shell/emu -I./shell/scalers -I./shell/emu -I./shell/audio -I./shell/menu -I./shell/video/sdl -I./shell/input -Ishell/headers
+
+CFLAGS += -Ofast -fsingle-precision-constant -fno-PIC -flto
+ifndef PROFILE
+CFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 -falign-labels=1
+endif
+CFLAGS += -DNDEBUG -DLAGFIX -DFRAMESKIP -DUSE_BLARGG_APU -DGIT_VERSION=\"$(GIT_VERSION)\" -fno-builtin -fno-exceptions -ffunction-sections -std=gnu99
+CFLAGS += -Wall -Wextra -pedantic -Wno-switch -Wno-implicit-function-declaration -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-uninitialized -Wno-strict-aliasing -Wno-overflow -fno-strict-overflow
+
+ifeq ($(PROFILE), YES)
+CFLAGS += -fprofile-generate=./profile
+else ifeq ($(PROFILE), APPLY)
+CFLAGS += -fprofile-use -fprofile-dir=./profile -fbranch-probabilities
+endif
+
+LDFLAGS = -lc -lgcc -lm $(SDL_LIBS) -no-pie -Wl,--as-needed -Wl,--gc-sections -s -flto
+ifeq ($(SOUND_BACKEND), portaudio)
+LDFLAGS += -lasound -lportaudio
+endif
+ifeq ($(SOUND_BACKEND), libao)
+LDFLAGS += -lao
+endif
+ifeq ($(SOUND_BACKEND), alsa)
+LDFLAGS += -lasound
+endif
+ifeq ($(SOUND_BACKEND), pulse)
+LDFLAGS += -lpulse -lpulse-simple
+endif
+
+ifeq ($(PROFILE), YES)
+LDFLAGS += -lgcov
+endif
+
+# Files to be compiled
+SRCDIR = ./source ./shell/emu ./shell/scalers ./shell/audio/$(SOUND_BACKEND) ./shell/menu ./shell/video/$(VIDEO_BACKEND) ./shell/input/$(INPUT_BACKEND) ./shell/other
+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)
+
+# Rules to make executable
+$(PRGNAME): $(OBJS)
+ $(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
+
+$(OBJ_C) : %.o : %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f $(PRGNAME)$(EXESUFFIX) *.o