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.

175 lines
5.4KB

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