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.

156 lines
4.8KB

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