Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. STATIC_LINKING := 0
  2. AR := ar
  3. LIBRETRO_COMM_DIR := libcommon
  4.  
  5. ifeq ($(platform),)
  6. platform = unix
  7. ifeq ($(shell uname -a),)
  8. platform = win
  9. else ifneq ($(findstring MINGW,$(shell uname -a)),)
  10. platform = win
  11. else ifneq ($(findstring Darwin,$(shell uname -a)),)
  12. platform = osx
  13. else ifneq ($(findstring win,$(shell uname -a)),)
  14. platform = win
  15. endif
  16. endif
  17.  
  18. # system platform
  19. system_platform = unix
  20. ifeq ($(shell uname -a),)
  21. EXE_EXT = .exe
  22. system_platform = win
  23. else ifneq ($(findstring Darwin,$(shell uname -a)),)
  24. system_platform = osx
  25. arch = intel
  26. ifeq ($(shell uname -p),powerpc)
  27. arch = ppc
  28. endif
  29. else ifneq ($(findstring MINGW,$(shell uname -a)),)
  30. system_platform = win
  31. endif
  32.  
  33. TARGET_NAME := testaudio_playback_wav
  34. LIBM = -lm
  35.  
  36. ifeq ($(ARCHFLAGS),)
  37. ifeq ($(archs),ppc)
  38. ARCHFLAGS = -arch ppc -arch ppc64
  39. else
  40. ARCHFLAGS = -arch i386 -arch x86_64
  41. endif
  42. endif
  43.  
  44. ifeq ($(platform), osx)
  45. ifndef ($(NOUNIVERSAL))
  46. CFLAGS += $(ARCHFLAGS)
  47. LFLAGS += $(ARCHFLAGS)
  48. endif
  49. endif
  50.  
  51. ifeq ($(STATIC_LINKING), 1)
  52. EXT := a
  53. endif
  54.  
  55. ifeq ($(platform), unix)
  56. EXT ?= so
  57. TARGET := $(TARGET_NAME)_libretro.$(EXT)
  58. fpic := -fPIC
  59. SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
  60. else ifeq ($(platform), linux-portable)
  61. TARGET := $(TARGET_NAME)_libretro.$(EXT)
  62. fpic := -fPIC -nostdlib
  63. SHARED := -shared -Wl,--version-script=link.T
  64. LIBM :=
  65. else ifneq (,$(findstring osx,$(platform)))
  66. TARGET := $(TARGET_NAME)_libretro.dylib
  67. fpic := -fPIC
  68. SHARED := -dynamiclib
  69. else ifneq (,$(findstring ios,$(platform)))
  70. TARGET := $(TARGET_NAME)_libretro_ios.dylib
  71. fpic := -fPIC
  72. SHARED := -dynamiclib
  73.  
  74. ifeq ($(IOSSDK),)
  75. IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
  76. endif
  77.  
  78. DEFINES := -DIOS
  79. CC = cc -arch armv7 -isysroot $(IOSSDK)
  80. ifeq ($(platform),ios9)
  81. CC += -miphoneos-version-min=8.0
  82. CFLAGS += -miphoneos-version-min=8.0
  83. else
  84. CC += -miphoneos-version-min=5.0
  85. CFLAGS += -miphoneos-version-min=5.0
  86. endif
  87. else ifneq (,$(findstring qnx,$(platform)))
  88. TARGET := $(TARGET_NAME)_libretro_qnx.so
  89. fpic := -fPIC
  90. SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
  91. else ifeq ($(platform), emscripten)
  92. TARGET := $(TARGET_NAME)_libretro_emscripten.bc
  93. fpic := -fPIC
  94. SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
  95. else ifeq ($(platform), vita)
  96. TARGET := $(TARGET_NAME)_vita.a
  97. CC = arm-vita-eabi-gcc
  98. AR = arm-vita-eabi-ar
  99. CFLAGS += -Wl,-q -Wall -O3
  100. STATIC_LINKING = 1
  101. else
  102. CC = gcc
  103. TARGET := $(TARGET_NAME)_libretro.dll
  104. SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
  105. endif
  106.  
  107. LDFLAGS += $(LIBM)
  108.  
  109. ifeq ($(DEBUG), 1)
  110. CFLAGS += -O0 -g
  111. else
  112. CFLAGS += -O0 -g
  113. endif
  114. OBJECTS := libretro-test.o
  115. OBJECTS += libcommon/audio_mixer.o libcommon/rwav.o libcommon/memalign.o \
  116. libcommon/audio_resampler.o libcommon/sinc_resampler.o \
  117. libcommon/features_cpu.o libcommon/compat_strl.o \
  118.  
  119.  
  120.  
  121. CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -Wall -pedantic $(fpic)
  122.  
  123. ifneq (,$(findstring qnx,$(platform)))
  124. CFLAGS += -Wc,-std=c99
  125. else
  126. CFLAGS += -std=gnu99
  127. endif
  128.  
  129. all: $(TARGET)
  130.  
  131. $(TARGET): $(OBJECTS)
  132. ifeq ($(STATIC_LINKING), 1)
  133. $(AR) rcs $@ $(OBJECTS)
  134. else
  135. $(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
  136. endif
  137.  
  138. %.o: %.c
  139. $(CC) $(CFLAGS) $(fpic) -c -o $@ $<
  140.  
  141. clean:
  142. rm -f $(OBJECTS) $(TARGET)
  143.  
  144. .PHONY: clean
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement