SHARE
TWEET

Untitled

a guest Feb 7th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #libretro-buildbot
  2.  
  3. STATIC_LINKING := 0
  4. AR             := ar
  5. INSTALL        := install
  6. RM             := rm
  7. STRIP          := strip
  8. GIT_VERSION := " $(shell git rev-parse --short HEAD)"
  9. BINDIR         ?= bin
  10. LIBDIR         ?= lib
  11. DATADIR        ?= share
  12. LIBRETRO_DIR   ?= libretro
  13. MANDIR := man/man6
  14. CFLAGS := $(filter-out -D_FORTIFY_SOURCE=1,$(CFLAGS))
  15. CFLAGS := $(filter-out -D_FORTIFY_SOURCE=2,$(CFLAGS))
  16. CFLAGS := $(filter-out -D_FORTIFY_SOURCE,$(CFLAGS))
  17. CXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=1,$(CXXFLAGS))
  18. CXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=2,$(CXXFLAGS))
  19. CXXFLAGS := $(filter-out -D_FORTIFY_SOURCE,$(CXXFLAGS))
  20. CPPFLAGS := $(filter-out -D_FORTIFY_SOURCE=1,$(CPPFLAGS))
  21. CPPFLAGS := $(filter-out -D_FORTIFY_SOURCE=2,$(CPPFLAGS))
  22. CPPFLAGS := $(filter-out -D_FORTIFY_SOURCE,$(CPPFLAGS))
  23.  
  24. ifeq ($(platform),)
  25. platform = unix
  26. ifeq ($(shell uname -a),)
  27.    platform = win
  28. else ifneq ($(findstring MINGW,$(shell uname -a)),)
  29.    platform = win
  30. else ifneq ($(findstring Darwin,$(shell uname -a)),)
  31.    platform = osx
  32. else ifneq ($(findstring win,$(shell uname -a)),)
  33.    platform = win
  34. endif
  35. endif
  36.  
  37. ifeq ($(platform), win)
  38.     LDFLAGS += -liphlpapi -lws2_32
  39. endif
  40.  
  41. CORE_DIR = .
  42. export DEPSDIR := $(CURDIR)/
  43.  
  44. # system platform
  45. system_platform = unix
  46. ifeq ($(shell uname -a),)
  47.     EXE_EXT = .exe
  48.     system_platform = win
  49. else ifneq ($(findstring Darwin,$(shell uname -a)),)
  50.     system_platform = osx
  51.     arch = intel
  52. else ifneq ($(findstring FreeBSD,$(shell uname -o)),)
  53.     system_platform = freebsd
  54. else ifneq ($(findstring Haiku,$(shell uname -o)),)
  55.     system_platform = haiku
  56. ifeq ($(shell uname -p),powerpc)
  57.     arch = ppc
  58.     CFLAGS += -DMSB_FIRST
  59. endif
  60. else ifneq ($(findstring MINGW,$(shell uname -a)),)
  61.     system_platform = win
  62. else ifeq ($(shell uname -p),ppc)
  63.     arch = ppc
  64.     CFLAGS += -DMSB_FIRST
  65. endif
  66.  
  67. TARGET_NAME := mrboom
  68.  
  69. ifeq ($(ARCHFLAGS),)
  70. ifeq ($(archs),ppc)
  71.    ARCHFLAGS = -arch ppc -arch ppc64
  72. else
  73.    ARCHFLAGS = -arch i386 -arch x86_64
  74. endif
  75. endif
  76.  
  77. ifneq ($(SANITIZER),)
  78.     CFLAGS   := -fsanitize=$(SANITIZER) $(CFLAGS)
  79.     LDFLAGS  := -fsanitize=$(SANITIZER) $(LDFLAGS)
  80. endif
  81.  
  82. ifeq ($(platform), osx)
  83. ifndef ($(NOUNIVERSAL))
  84.    CFLAGS += $(ARCHFLAGS)
  85.    LFLAGS += $(ARCHFLAGS)
  86. ifneq ($(LIBSDL2),)
  87.    CFLAGS += -I/usr/local/include
  88.    LDFLAGS += -L/usr/local/lib
  89. endif
  90. endif
  91. endif
  92.  
  93. ifeq ($(STATIC_LINKING), 1)
  94. EXT := a
  95. endif
  96.  
  97. ifeq ($(platform), unix)
  98.     EXT ?= so
  99.    TARGET := $(TARGET_NAME)_libretro.$(EXT)
  100.    fpic := -fPIC
  101.    SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
  102.    ifeq ($(system_platform), haiku)
  103.     LDFLAGS += -lroot -lnetwork
  104.    endif
  105. else ifeq ($(platform), linux-portable)
  106.    TARGET := $(TARGET_NAME)_libretro.$(EXT)
  107.    fpic := -fPIC -nostdlib
  108.    SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T
  109.     LIBM :=
  110.  
  111. # OS X
  112. else ifneq (,$(findstring osx,$(platform)))
  113.    TARGET := $(TARGET_NAME)_libretro.dylib
  114.    fpic := -fPIC
  115.    SHARED := -dynamiclib
  116.    PREFIX := /usr/local
  117.    MANDIR := share/man/man6
  118. # iOS
  119. else ifneq (,$(findstring ios,$(platform)))
  120.    TARGET := $(TARGET_NAME)_libretro_ios.dylib
  121.     fpic := -fPIC
  122.     SHARED := -dynamiclib
  123. ifeq ($(IOSSDK),)
  124.    IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
  125. endif
  126.     DEFINES := -DIOS
  127.   ifeq ($(platform),ios-arm64)
  128.     CC = cc -arch arm64 -isysroot $(IOSSDK)
  129.     CXX = c++ -arch arm64 -isysroot $(IOSSDK)
  130.   else 
  131.     CC = cc -arch armv7 -isysroot $(IOSSDK)
  132.     CXX = c++ -arch armv7 -isysroot $(IOSSDK)
  133. endif
  134. ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
  135. CC     += -miphoneos-version-min=8.0
  136. CFLAGS += -miphoneos-version-min=8.0 -DDONT_WANT_ARM_OPTIMIZATIONS
  137. else
  138. CC     += -miphoneos-version-min=5.0
  139. CFLAGS += -miphoneos-version-min=5.0 -DIOS -DDONT_WANT_ARM_OPTIMIZATIONS
  140. endif
  141.  
  142. # QNX
  143. else ifneq (,$(findstring qnx,$(platform)))
  144.     TARGET := $(TARGET_NAME)_libretro_qnx.so
  145.    fpic := -fPIC
  146.    SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
  147. else ifeq ($(platform), emscripten)
  148.    TARGET := $(TARGET_NAME)_libretro_emscripten.bc
  149.    fpic := -fPIC
  150.    SHARED := -shared -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
  151.  
  152. # Vita
  153. else ifeq ($(platform), vita)
  154.    TARGET := $(TARGET_NAME)_vita.a
  155.    CC = arm-vita-eabi-gcc
  156.    AR = arm-vita-eabi-ar
  157.    CFLAGS += -Wl,-q -Wall -O3
  158.     STATIC_LINKING = 1
  159. # Nintendo Game Cube
  160. else ifeq ($(platform), ngc)
  161.    TARGET := $(TARGET_NAME)_libretro_$(platform).a
  162.    CC = powerpc-eabi-gcc$(EXE_EXT)
  163.    CXX = powerpc-eabi-g++$(EXE_EXT)
  164.    AR = powerpc-eabi-ar$(EXE_EXT)
  165.    CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DMSB_FIRST
  166.    CFLAGS += -DUSE_FILE32API -DNO_NETWORK
  167.    CFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
  168.    STATIC_LINKING = 1
  169.  
  170. # Nintendo Wii
  171. else ifeq ($(platform), wii)
  172.    TARGET := $(TARGET_NAME)_libretro_$(platform).a
  173.    CC = powerpc-eabi-gcc$(EXE_EXT)
  174.    CXX = powerpc-eabi-g++$(EXE_EXT)
  175.    AR = powerpc-eabi-ar$(EXE_EXT)
  176.    CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DMSB_FIRST
  177.    CFLAGS += -DUSE_FILE32API -DNO_NETWORK
  178.    CFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
  179.    STATIC_LINKING = 1
  180.  
  181. # Nintendo Switch (libnx)
  182. else ifeq ($(platform), libnx)
  183.     include $(DEVKITPRO)/libnx/switch_rules
  184.     EXT=a
  185.     TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
  186.     DEFINES := -DSWITCH=1 -U__linux__ -U__linux
  187.     CFLAGS  := $(DEFINES) -g -O3 \
  188.                  -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -Wl,--allow-multiple-definition -specs=$(LIBNX)/switch.specs
  189.     CFLAGS += $(INCDIRS)
  190.     CFLAGS  +=  -D__SWITCH__ -DHAVE_LIBNX -march=armv8-a -mtune=cortex-a57 -mtp=soft
  191.     CXXFLAGS := $(ASFLAGS) -fno-rtti -std=gnu++11
  192.     CFLAGS += -std=gnu11
  193.     CFLAGS += -DUSE_FILE32API
  194.     STATIC_LINKING = 1
  195.  
  196. # Nintendo WiiU
  197. else ifeq ($(platform), wiiu)
  198.    TARGET := $(TARGET_NAME)_libretro_$(platform).a
  199.    CC = powerpc-eabi-gcc$(EXE_EXT)
  200.    CXX = powerpc-eabi-g++$(EXE_EXT)
  201.    AR = powerpc-eabi-ar$(EXE_EXT)
  202.    CFLAGS += -mwup -mcpu=750 -meabi -mhard-float -DMSB_FIRST
  203.    CFLAGS += -DUSE_FILE32API -DNO_NETWORK
  204.    CFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
  205.    STATIC_LINKING = 1
  206.  
  207. # Nintendo Switch (libtransistor)
  208. else ifeq ($(platform), switch)
  209.    TARGET := $(TARGET_NAME)_libretro_$(platform).a
  210.    include $(LIBTRANSISTOR_HOME)/libtransistor.mk
  211.    CFLAGS += $(CXX_FLAGS)
  212.    STATIC_LINKING=1
  213.  
  214. # Classic Platforms ####################
  215. # Platform affix = classic_<ISA>_<µARCH>
  216. # Help at https://modmyclassic.com/comp
  217.  
  218. # (armv7 a7, hard point, neon based) ###
  219. # NESC, SNESC, C64 mini
  220. else ifeq ($(platform), classic_armv7_a7)
  221.     TARGET := $(TARGET_NAME)_libretro.so
  222.     fpic := -fPIC
  223.     LDFLAGS := -shared -Wl,--version-script=$(CORE_DIR)/link.T  -Wl,--no-undefined
  224.     CFLAGS += -Ofast \
  225.     -flto=4 -fwhole-program -fuse-linker-plugin \
  226.     -fdata-sections -ffunction-sections -Wl,--gc-sections \
  227.     -fno-stack-protector -fno-ident -fomit-frame-pointer \
  228.     -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
  229.     -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
  230.     -fmerge-all-constants -fno-math-errno \
  231.     -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
  232.     CXXFLAGS += $(CFLAGS)
  233.     CPPFLAGS += $(CFLAGS)
  234.     ASFLAGS += $(CFLAGS)
  235.     ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1)
  236.       CFLAGS += -march=armv7-a
  237.     else
  238.       CFLAGS += -march=armv7ve
  239.       # If gcc is 5.0 or later
  240.       ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
  241.         LDFLAGS += -static-libgcc -static-libstdc++
  242.       endif
  243.     endif
  244. #######################################
  245.  
  246. else ifeq ($(platform), genode)
  247.    TARGET   := $(TARGET_NAME)_libretro.lib.so
  248.    CC       := $(shell pkg-config genode-base --variable=cc)
  249.    CXX      := $(shell pkg-config genode-base --variable=cxx)
  250.    LD       := $(shell pkg-config genode-base --variable=ld)
  251.    CFLAGS   += $(shell pkg-config --cflags genode-libc)
  252.    CXXFLAGS += $(shell pkg-config --cflags genode-stdcxx)
  253.    LDFLAGS  += -shared --version-script=link.T
  254.    LDFLAGS  += $(shell pkg-config --libs genode-lib genode-libc genode-stdcxx)
  255.    LIBM =
  256.  
  257. # Windows MSVC 2003 Xbox 1
  258. else ifeq ($(platform), xbox1_msvc2003)
  259. TARGET := $(TARGET_NAME)_libretro_xdk1.lib
  260. CC  = CL.exe
  261. CXX  = CL.exe
  262. LD   = lib.exe
  263. LOAD_FROM_FILES := 1
  264. export INCLUDE := $(XDK)/xbox/include
  265. export LIB := $(XDK)/xbox/lib
  266. PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
  267. PSS_STYLE :=2
  268. CFLAGS   += -D_XBOX -D_XBOX1
  269. CXXFLAGS += -D_XBOX -D_XBOX1
  270. STATIC_LINKING=1
  271. HAS_GCC := 0
  272. # Windows MSVC 2010 Xbox 360
  273. else ifeq ($(platform), xbox360_msvc2010)
  274. TARGET := $(TARGET_NAME)_libretro_xdk360.lib
  275. MSVCBINDIRPREFIX = $(XEDK)/bin/win32
  276. CC  = "$(MSVCBINDIRPREFIX)/cl.exe"
  277. CXX  = "$(MSVCBINDIRPREFIX)/cl.exe"
  278. LD   = "$(MSVCBINDIRPREFIX)/lib.exe"
  279.  
  280. export INCLUDE := $(XEDK)/include/xbox
  281. export LIB := $(XEDK)/lib/xbox
  282. PSS_STYLE :=2
  283. FLAGS += -DMSB_FIRST
  284. CFLAGS   += -D_XBOX -D_XBOX360
  285. CXXFLAGS += -D_XBOX -D_XBOX360
  286. STATIC_LINKING=1
  287. HAS_GCC := 0
  288.  
  289. # Windows MSVC 2003 x86
  290. else ifeq ($(platform), windows_msvc2003_x86)
  291.     CC  = cl.exe
  292.     CXX = cl.exe
  293.  
  294. LOAD_FROM_FILES := 1
  295. CFLAGS += -DLOAD_FROM_FILES
  296. PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
  297. PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
  298. INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/include")
  299. LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS71COMNTOOLS)../../Vc7/lib")
  300. BIN := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin")
  301.  
  302. WindowsSdkDir := $(INETSDK)
  303.  
  304. export INCLUDE := $(INCLUDE);$(INETSDK)/Include;src/drivers/libretro/msvc/msvc-2005
  305. export LIB := $(LIB);$(WindowsSdkDir);$(INETSDK)/Lib
  306. TARGET := $(TARGET_NAME)_libretro.dll
  307. PSS_STYLE :=2
  308. LDFLAGS += -DLL
  309. CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
  310.  
  311. else
  312.    CC = gcc
  313.    TARGET := $(TARGET_NAME)_libretro.dll
  314.    SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(CORE_DIR)/link.T -Wl,--no-undefined
  315. endif
  316.  
  317. LIBM    ?= -lm
  318. LDFLAGS += $(LIBM)
  319.  
  320. ifneq ($(LOAD_FROM_FILES),)
  321. CFLAGS += -DLOAD_FROM_FILES
  322. LDFLAGS += -lminizip
  323. endif
  324.  
  325. ifneq ($(DEBUG),)
  326. CFLAGS += -g -pg -DDEBUG
  327. LDFLAGS += -g -pg
  328. else
  329. ifneq ($(system_platform),freebsd)
  330. CFLAGS += -O3
  331. endif
  332. endif
  333.  
  334. CFLAGS += -DMRBOOM -DHAVE_IBXM -D_FORTIFY_SOURCE=0 -DPLATFORM=\"$(platform)\" -DGIT_VERSION=\"$(GIT_VERSION)\"
  335.  
  336. SDL2LIBS :=  -lSDL2  -lSDL2_mixer -lminizip -lmodplug
  337.  
  338. include Makefile.common
  339. OBJECTS := $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o) $(SOURCES_ASM:.S=.o)
  340.  
  341. ifneq ($(LIBSDL2),)
  342. CFLAGS += -D__LIBSDL2__ -Isdl2/xBRZ
  343. ifneq ($(MINGW),)
  344. PATH := /${MINGW}/bin:${PATH}
  345. CFLAGS += -I/${MINGW}/include
  346. LDFLAGS += -L/${MINGW}/lib -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -lstdc++ -lmingw32 -lSDL2main ${SDL2LIBS} -lbz2 -lz -lstdc++ -lwinpthread
  347. LDFLAGS += -Wl,-Bdynamic -lole32 -limm32 -lversion -lOleaut32 -lGdi32 -lWinmm
  348. OBJECTS += Assets/mrboom.res
  349. else
  350. ifneq ($(LIBSDL2),)
  351. LDFLAGS += ${SDL2LIBS}
  352. endif
  353. endif
  354. else
  355. CFLAGS += -D__LIBRETRO__
  356. endif
  357.  
  358. ifneq ($(TESTS),)
  359. ifeq ($(platform), win)
  360. LDFLAGS += -mwindows
  361. else
  362. ifneq ($(platform), osx)
  363. LDFLAGS += -lrt
  364. endif
  365. endif
  366. ifeq ($(TESTS), 2)
  367. CFLAGS += -DAITEST
  368. endif
  369. endif
  370.  
  371. CXXFLAGS += $(CFLAGS) $(INCFLAGS) -Wall -pedantic $(fpic)
  372. ifneq ($(LIBSDL2),)
  373. CXXFLAGS += -std=c++11
  374. else
  375. CXXFLAGS += -std=c++98
  376. endif
  377.  
  378. ifneq ($(SCREENSHOTS),)
  379. CXXFLAGS += -std=c++11 -Isdl2/xBRZ
  380. endif
  381.  
  382. ifneq ($(STATETESTS),)
  383. CXXFLAGS += -std=c++11 -Isdl2/xBRZ
  384. endif
  385.  
  386. CFLAGS += $(INCFLAGS) -Wall -pedantic $(fpic)
  387.  
  388. ifneq (,$(findstring qnx,$(platform)))
  389. CFLAGS += -Wc,-std=c99
  390. else
  391. CFLAGS += -std=gnu99
  392. endif
  393.  
  394. all: $(TARGET)
  395.  
  396. $(TARGET): $(OBJECTS)
  397.     @echo "** BUILDING $(TARGET) FOR PLATFORM $(platform) **"
  398. ifeq ($(STATIC_LINKING), 1)
  399.     $(AR) rcs $@ $(OBJECTS)
  400. else
  401. ifeq ($(platform),genode)
  402.     $(LD) -o $@ $(OBJECTS) $(LDFLAGS)
  403. else
  404.     $(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
  405. endif
  406. endif
  407.     @echo "** BUILD SUCCESSFUL! GG NO RE **"
  408.  
  409. %.o: %.c
  410.     $(CC) $(CFLAGS) $(fpic) -c -o $@ $<
  411.  
  412. %.res: %.rc
  413.     windres $< -O coff -o $@
  414.  
  415. mrboomTest: $(OBJECTS)
  416.     $(CXX) $(fpic) $(OBJECTS) -o mrboomTest.out $(LDFLAGS)
  417.  
  418. mrboom: $(OBJECTS)
  419.     $(CXX) $(fpic) $(OBJECTS) -o $(TARGET_NAME).out $(LDFLAGS)
  420.  
  421. CLEAN_TARGETS = $(OBJECTS)
  422. ifneq ($(TESTS),)
  423. CLEAN_TARGETS += $(TARGET)
  424. endif
  425.  
  426. clean:
  427.     rm -f *.o */*.o */*/*.o */*/*/*.o */*/*/*/*.o */*/*/*/*/*.o
  428.     rm -f *.a */*.a */*/*.a */*/*/*.a */*/*/*/*.a */*/*/*/*/*.a
  429.     rm -f *.d */*.d */*/*.d */*/*/*.d */*/*/*/*.d */*/*/*/*/*.d
  430.  
  431. strip:
  432.     $(STRIP) $(TARGET_NAME).out
  433.  
  434. install: strip
  435.     $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/$(BINDIR)
  436.     $(INSTALL) -m 555 $(TARGET_NAME).out $(DESTDIR)$(PREFIX)/$(BINDIR)/$(TARGET_NAME)
  437.     $(INSTALL) -m 0755 -d $(DESTDIR)$(PREFIX)/$(MANDIR)
  438.     $(INSTALL) -m 644 Assets/$(TARGET_NAME).6 $(DESTDIR)$(PREFIX)/$(MANDIR)
  439.  
  440. install-libretro:
  441.     $(INSTALL) -D -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/$(LIBDIR)/$(LIBRETRO_DIR)/$(TARGET)
  442.     $(INSTALL) -D -m 644 Assets/mrboom.png $(DESTDIR)$(PREFIX)/$(DATADIR)/icons/hicolor/1024x1024/apps/mrboom.png
  443.     $(INSTALL) -D -m 644 Assets/mrboom.libretro $(DESTDIR)$(PREFIX)/$(LIBDIR)/$(LIBRETRO_DIR)/mrboom.libretro
  444.  
  445. uninstall-libretro:
  446.     $(RM) $(DESTDIR)$(PREFIX)/$(LIBDIR)/$(LIBRETRO_DIR)/$(TARGET)
  447.     $(RM) $(DESTDIR)$(PREFIX)/$(DATADIR)/icons/hicolor/1024x1024/apps/mrboom.png
  448.     $(RM) $(DESTDIR)$(PREFIX)/$(LIBDIR)/$(LIBRETRO_DIR)/mrboom.libretro
  449.  
  450. .PHONY: clean install-libretro uninstall-libretro
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top