You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
6.3KB

  1. FLAGS += \
  2. -Iinclude \
  3. -Idep/include -Idep/lib/libzip/include
  4. SOURCES = $(wildcard src/*.cpp src/*/*.cpp) \
  5. ext/nanovg/src/nanovg.c
  6. include arch.mk
  7. ifeq ($(ARCH), lin)
  8. SOURCES += ext/osdialog/osdialog_gtk2.c
  9. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  10. LDFLAGS += -rdynamic \
  11. -lpthread -lGL -ldl \
  12. $(shell pkg-config --libs gtk+-2.0) \
  13. -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lportaudio -lrtmidi
  14. TARGET = Rack
  15. endif
  16. ifeq ($(ARCH), lin)
  17. SOURCES += ext/osdialog/osdialog_gtk2.c
  18. CFLAGS += $(shell pkg-config --cflags gtk+-2.0)
  19. LDFLAGS += -rdynamic \
  20. -lpthread -lGL -ldl \
  21. $(shell pkg-config --libs gtk+-2.0) \
  22. -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lportaudio -lrtmidi
  23. TARGET = Rack
  24. endif
  25. ifeq ($(ARCH), mac)
  26. SOURCES += ext/osdialog/osdialog_mac.m
  27. CXXFLAGS += -DAPPLE -stdlib=libc++
  28. LDFLAGS += -stdlib=libc++ -lpthread -ldl \
  29. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \
  30. -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lportaudio -lrtmidi
  31. TARGET = Rack
  32. endif
  33. ifeq ($(ARCH), win)
  34. SOURCES += ext/osdialog/osdialog_win.c
  35. LDFLAGS += -static-libgcc -static-libstdc++ -lpthread \
  36. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  37. -lgdi32 -lopengl32 -lcomdlg32 -lole32 \
  38. -Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lportaudio_x64 -lrtmidi \
  39. -Wl,-Bstatic -ljansson -lsamplerate
  40. TARGET = Rack.exe
  41. OBJECTS = Rack.res
  42. endif
  43. all: $(TARGET)
  44. ifeq ($(ARCH), mac)
  45. SOURCES += ext/osdialog/osdialog_mac.m
  46. CXXFLAGS += -DAPPLE -stdlib=libc++
  47. LDFLAGS += -stdlib=libc++ -lpthread -ldl \
  48. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \
  49. -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lportaudio -lrtmidi
  50. TARGET = Rack
  51. endif
  52. ifeq ($(ARCH), win)
  53. SOURCES += ext/osdialog/osdialog_win.c
  54. LDFLAGS += -static-libgcc -static-libstdc++ -lpthread \
  55. -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \
  56. -lgdi32 -lopengl32 -lcomdlg32 -lole32 \
  57. -Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lportaudio_x64 -lrtmidi \
  58. -Wl,-Bstatic -ljansson -lsamplerate
  59. TARGET = Rack.exe
  60. OBJECTS = Rack.res
  61. endif
  62. all: $(TARGET)
  63. dep:
  64. $(MAKE) -C dep
  65. run: $(TARGET)
  66. ifeq ($(ARCH), lin)
  67. LD_LIBRARY_PATH=dep/lib ./$<
  68. endif
  69. ifeq ($(ARCH), mac)
  70. DYLD_FALLBACK_LIBRARY_PATH=dep/lib ./$<
  71. endif
  72. ifeq ($(ARCH), win)
  73. # TODO get rid of the mingw64 path
  74. env PATH=dep/bin:/mingw64/bin ./$<
  75. endif
  76. debug: $(TARGET)
  77. ifeq ($(ARCH), mac)
  78. lldb ./Rack
  79. else
  80. LD_LIBRARY_PATH=dep/lib gdb -ex run ./Rack
  81. endif
  82. clean:
  83. rm -rfv $(TARGET) build dist
  84. # For Windows resources
  85. %.res: %.rc
  86. windres $^ -O coff -o $@
  87. include compile.mk
  88. dist: all
  89. rm -rf dist
  90. $(MAKE) -C plugins/Fundamental dist
  91. ifeq ($(ARCH), mac)
  92. $(eval BUNDLE := dist/$(TARGET).app)
  93. mkdir -p $(BUNDLE)
  94. mkdir -p $(BUNDLE)/Contents
  95. mkdir -p $(BUNDLE)/Contents/Resources
  96. cp Info.plist $(BUNDLE)/Contents/
  97. cp -R LICENSE* res $(BUNDLE)/Contents/Resources
  98. mkdir -p $(BUNDLE)/Contents/MacOS
  99. cp Rack $(BUNDLE)/Contents/MacOS/
  100. cp icon.icns $(BUNDLE)/Contents/Resources/
  101. otool -L $(BUNDLE)/Contents/MacOS/Rack
  102. cp dep/lib/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/
  103. cp dep/lib/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/
  104. cp dep/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/
  105. cp dep/lib/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/
  106. cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/
  107. cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/
  108. cp dep/lib/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/
  109. cp dep/lib/librtmidi.dylib $(BUNDLE)/Contents/MacOS/
  110. install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/Rack
  111. install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/Rack
  112. install_name_tool -change $(PWD)/dep/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  113. install_name_tool -change $(PWD)/dep/lib/libsamplerate.0.dylib @executable_path/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/Rack
  114. install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  115. install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/Rack
  116. install_name_tool -change $(PWD)/dep/lib/libportaudio.2.dylib @executable_path/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/Rack
  117. install_name_tool -change @rpath/librtmidi.dylib @executable_path/librtmidi.dylib $(BUNDLE)/Contents/MacOS/Rack
  118. otool -L $(BUNDLE)/Contents/MacOS/Rack
  119. mkdir -p $(BUNDLE)/Contents/Resources/plugins
  120. cp -R plugins/Fundamental/dist/Fundamental $(BUNDLE)/Contents/Resources/plugins
  121. endif
  122. ifeq ($(ARCH), win)
  123. mkdir -p dist/Rack
  124. cp -R LICENSE* res dist/Rack/
  125. cp Rack.exe dist/Rack/
  126. cp /mingw64/bin/libwinpthread-1.dll dist/Rack/
  127. cp /mingw64/bin/zlib1.dll dist/Rack/
  128. cp /mingw64/bin/libstdc++-6.dll dist/Rack/
  129. cp /mingw64/bin/libgcc_s_seh-1.dll dist/Rack/
  130. cp dep/bin/glew32.dll dist/Rack/
  131. cp dep/bin/glfw3.dll dist/Rack/
  132. cp dep/bin/libcurl-4.dll dist/Rack/
  133. cp dep/bin/libjansson-4.dll dist/Rack/
  134. cp dep/bin/librtmidi.dll dist/Rack/
  135. cp dep/bin/libsamplerate-0.dll dist/Rack/
  136. cp dep/bin/libzip-5.dll dist/Rack/
  137. cp dep/bin/portaudio_x64.dll dist/Rack/
  138. mkdir -p dist/Rack/plugins
  139. cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/
  140. endif
  141. ifeq ($(ARCH), lin)
  142. mkdir -p dist/Rack
  143. cp -R LICENSE* res dist/Rack/
  144. cp Rack Rack.sh dist/Rack/
  145. cp dep/lib/libsamplerate.so.0 dist/Rack/
  146. cp dep/lib/libjansson.so.4 dist/Rack/
  147. cp dep/lib/libGLEW.so.2.1 dist/Rack/
  148. cp dep/lib/libglfw.so.3 dist/Rack/
  149. cp dep/lib/libcurl.so.4 dist/Rack/
  150. cp dep/lib/libzip.so.5 dist/Rack/
  151. cp dep/lib/libportaudio.so.2 dist/Rack/
  152. cp dep/lib/librtmidi.so dist/Rack/
  153. mkdir -p dist/Rack/plugins
  154. cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/
  155. endif
  156. ifeq ($(ARCH), mac)
  157. cd dist && ln -s /Applications Applications
  158. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  159. else
  160. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  161. endif
  162. # Plugin helpers
  163. allplugins:
  164. for f in plugins/*; do $(MAKE) -C "$$f"; done
  165. cleanplugins:
  166. for f in plugins/*; do $(MAKE) -C "$$f" clean; done
  167. distplugins:
  168. for f in plugins/*; do $(MAKE) -C "$$f" dist; done
  169. plugins:
  170. for f in plugins/*; do (cd "$$f" && ${CMD}); done
  171. .PHONY: all dep run debug clean dist allplugins cleanplugins distplugins plugins