| 1 |
processors := arm hg51b upd96050 gsu r65816 spc700 lr35902 |
| 2 |
include processor/Makefile |
| 3 |
|
| 4 |
include sfc/Makefile |
| 5 |
include gb/Makefile |
| 6 |
output := libretro |
| 7 |
|
| 8 |
core_installdir := $(prefix)/lib |
| 9 |
|
| 10 |
ifeq ($(platform),linux) |
| 11 |
flags += -fPIC |
| 12 |
ifeq ($(arch),arm) |
| 13 |
flags += -marm |
| 14 |
endif |
| 15 |
else ifeq ($(platform),bsd) |
| 16 |
flags += -fPIC |
| 17 |
else ifeq ($(platform),macosx) |
| 18 |
flags += -fPIC |
| 19 |
else ifneq (,$(findstring ios,$(platform))) |
| 20 |
ifeq ($(IOSSDK),) |
| 21 |
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) |
| 22 |
endif |
| 23 |
flags += -arch armv7 -fPIC -isysroot $(IOSSDK) -marm -DHAVE_POSIX_MEMALIGN=1 -DIOS -w |
| 24 |
ifeq ($(platform),ios9) |
| 25 |
flags += -miphoneos-version-min=8.0 |
| 26 |
else |
| 27 |
flags += -miphoneos-version-min=5.0 |
| 28 |
endif |
| 29 |
endif |
| 30 |
|
| 31 |
flags += -D__LIBRETRO__ |
| 32 |
|
| 33 |
GIT_VERSION ?= " $(shell git rev-parse --short HEAD || echo unknown)" |
| 34 |
ifneq ($(GIT_VERSION)," unknown") |
| 35 |
flags += -DGIT_VERSION=\"$(GIT_VERSION)\" |
| 36 |
endif |
| 37 |
|
| 38 |
|
| 39 |
objects := $(patsubst %,obj/%.o,$(objects)) |
| 40 |
sfc_objects += libretro |
| 41 |
sfc_objects := $(patsubst %,obj/%-$(profile).o,$(sfc_objects)) |
| 42 |
objects += $(sfc_objects) |
| 43 |
|
| 44 |
obj/libretro-$(profile).o: $(ui)/libretro.cpp $(ui)/* |
| 45 |
|
| 46 |
|
| 47 |
build: $(objects) |
| 48 |
ifeq ($(platform),linux) |
| •49 |
$(compiler) -o out/bsnes_mercury_$(profile)_libretro.so -shared $(objects) -ldl -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T $(link) $(LDFLAGS) |
| 50 |
else ifeq ($(platform),bsd) |
| 51 |
$(compiler) -o out/bsnes_mercury_$(profile)_libretro.so -shared $(objects) -ldl -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T $(link) |
| 52 |
else ifeq ($(platform),haiku) |
| 53 |
$(compiler) -o out/bsnes_mercury_$(profile)_libretro.so -shared $(objects) -lroot -lnetwork -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T $(link) |
| 54 |
else ifneq (,$(findstring ios,$(platform))) |
| 55 |
$(compiler) -o out/bsnes_mercury_$(profile)_libretro_ios.dylib -dynamiclib $(objects) -isysroot $(IOSSDK) -arch armv7 $(link) |
| 56 |
else ifeq ($(platform),macosx) |
| 57 |
ifdef ($(NOUNIVERSAL)) |
| 58 |
$(compiler) -o out/bsnes_mercury_$(profile)_libretro.dylib -dynamiclib $(objects) $(link) |
| 59 |
else |
| 60 |
$(compiler) $(ARCHFLAGS) -o out/bsnes_mercury_$(profile)_libretro.dylib -dynamiclib $(objects) $(link) |
| 61 |
endif |
| 62 |
else ifeq ($(platform),windows) |
| 63 |
$(compiler) -o out/bsnes_mercury_$(profile)_libretro.dll -shared $(objects) -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T -static-libgcc -static-libstdc++ -lws2_32 $(link) |
| 64 |
else |
| 65 |
$(error invalid platform: $(platform). valid platforms are: windows linux macosx ios bsd) |
| 66 |
endif |
| 67 |
|
| 68 |
install: |
| 69 |
ifeq ($(platform),linux) |
| 70 |
install -D -m 755 out/bsnes_mercury_$(profile)_libretro.so $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro.so |
| 71 |
else ifeq ($(platform),bsd) |
| 72 |
install -D -m 755 out/bsnes_mercury_$(profile)_libretro.so $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro.so |
| 73 |
else ifeq ($(platform),macosx) |
| 74 |
cp out/bsnes_mercury_$(profile)_libretro.dylib $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro.dylib |
| 75 |
else ifneq (,$(findstring ios,$(platform))) |
| 76 |
cp out/bsnes_mercury_$(profile)_libretro_ios.dylib $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro_ios.dylib |
| 77 |
endif |
| 78 |
|
| 79 |
uninstall: |
| 80 |
ifeq ($(platform),linux) |
| 81 |
rm $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro.so |
| 82 |
else ifeq ($(platform),bsd) |
| 83 |
rm $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro.so |
| 84 |
else ifeq ($(platform),macosx) |
| 85 |
rm $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro.dylib |
| 86 |
else ifneq (,$(findstring ios,$(platform))) |
| 87 |
rm $(DESTDIR)$(core_installdir)/bsnes_mercury_$(profile)_libretro_ios.dylib |
| 88 |
endif |
| 89 |
|