2014-04-15 23:49:02 +00:00
|
|
|
compiler := gcc
|
|
|
|
extra_flags :=
|
|
|
|
use_neon := 0
|
2014-04-19 18:46:05 +00:00
|
|
|
release := release
|
|
|
|
DYLIB := so
|
2014-04-15 23:49:02 +00:00
|
|
|
|
2014-04-19 18:46:05 +00:00
|
|
|
ifeq ($(platform),)
|
|
|
|
platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
platform = osx
|
|
|
|
arch = intel
|
|
|
|
ifeq ($(shell uname -p),powerpc)
|
|
|
|
arch = ppc
|
|
|
|
endif
|
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
endif
|
2014-04-15 23:49:02 +00:00
|
|
|
endif
|
|
|
|
|
2014-04-19 18:46:05 +00:00
|
|
|
ifeq ($(platform),gcc)
|
|
|
|
extra_rules_gcc := $(shell $(compiler) -dumpmachine)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (,$(findstring armv7,$(extra_rules_gcc)))
|
2014-04-15 23:49:02 +00:00
|
|
|
extra_flags += -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon
|
|
|
|
use_neon := 1
|
|
|
|
endif
|
|
|
|
|
2014-04-19 18:46:05 +00:00
|
|
|
ifneq (,$(findstring hardfloat,$(extra_rules_gcc)))
|
2014-04-15 23:49:02 +00:00
|
|
|
extra_flags += -mfloat-abi=hard
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (release,$(build))
|
|
|
|
extra_flags += -O2
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (debug,$(build))
|
|
|
|
extra_flags += -O0 -g
|
|
|
|
endif
|
|
|
|
|
2014-04-19 18:46:05 +00:00
|
|
|
ldflags := -shared -Wl,--version-script=link.T
|
|
|
|
|
|
|
|
ifeq ($(platform), unix)
|
|
|
|
DYLIB = so
|
|
|
|
else ifeq ($(platform), osx)
|
|
|
|
compiler := $(CC)
|
|
|
|
DYLIB = dylib
|
|
|
|
ldflags := -dynamiclib
|
|
|
|
else
|
|
|
|
extra_flags += -static-libgcc -static-libstdc++
|
|
|
|
DYLIB = dll
|
|
|
|
endif
|
|
|
|
|
|
|
|
CC := $(compiler)
|
|
|
|
CXX := $(subst CC,++,$(compiler)) -std=gnu++0x
|
2014-04-15 23:49:02 +00:00
|
|
|
flags := -fPIC $(extra_flags)
|
|
|
|
asflags := -fPIC $(extra_flags)
|
|
|
|
objects :=
|
|
|
|
flags += -std=c99
|
|
|
|
|
|
|
|
|
|
|
|
ifeq (1,$(use_neon))
|
|
|
|
ASMFLAGS := -INEON/asm
|
|
|
|
asflags += -mfpu=neon
|
|
|
|
endif
|
|
|
|
|
2014-05-03 00:26:04 +00:00
|
|
|
objects += blargg_ntsc_snes_composite.$(DYLIB) blargg_ntsc_snes_rf.$(DYLIB) blargg_ntsc_snes_svideo.$(DYLIB) blargg_ntsc_snes_rgb.$(DYLIB) phosphor2x.$(DYLIB) epx.$(DYLIB) lq2x.$(DYLIB) 2xsai.$(DYLIB) super2xsai.$(DYLIB) supereagle.$(DYLIB) 2xbr.$(DYLIB) darken.$(DYLIB) scale2x.$(DYLIB)
|
2014-04-15 23:49:02 +00:00
|
|
|
|
|
|
|
all: build;
|
|
|
|
|
|
|
|
%.o: %.S
|
2014-04-19 18:46:05 +00:00
|
|
|
$(CC) -c -o $@ $(asflags) $(ASMFLAGS) $<
|
2014-04-15 23:49:02 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
2014-04-19 18:46:05 +00:00
|
|
|
$(CC) -c -o $@ $(flags) $<
|
2014-04-15 23:49:02 +00:00
|
|
|
|
2014-04-19 18:46:05 +00:00
|
|
|
%.$(DYLIB): %.o
|
|
|
|
$(CC) -o $@ $(ldflags) $(flags) $^
|
2014-04-15 23:49:02 +00:00
|
|
|
|
|
|
|
build: $(objects)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.o
|
2014-04-19 18:46:05 +00:00
|
|
|
rm -f *.$(DYLIB)
|
2014-04-15 23:49:02 +00:00
|
|
|
|
|
|
|
strip:
|
2014-04-19 18:46:05 +00:00
|
|
|
strip -s *.$(DYLIB)
|