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.

Makefile 4.3KB

7 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 -ljansson -lsamplerate -lcurl -lzip -lportaudio -lportmidi
  31. TARGET = Rack.exe
  32. # OBJECTS = Rack.res
  33. endif
  34. all: $(TARGET)
  35. run: $(TARGET)
  36. ifeq ($(ARCH), lin)
  37. LD_LIBRARY_PATH=dep/lib ./$<
  38. endif
  39. ifeq ($(ARCH), mac)
  40. DYLD_FALLBACK_LIBRARY_PATH=dep/lib ./$<
  41. endif
  42. ifeq ($(ARCH), win)
  43. # TODO get rid of the mingw64 path
  44. env PATH=dep/bin:/mingw64/bin ./$<
  45. endif
  46. clean:
  47. rm -rfv $(TARGET) build dist
  48. # For Windows resources
  49. %.res: %.rc
  50. windres $^ -O coff -o $@
  51. include compile.mk
  52. dist: all
  53. ifndef VERSION
  54. $(error VERSION is not set.)
  55. endif
  56. mkdir -p dist/Rack
  57. mkdir -p dist/Rack/plugins
  58. cp -R LICENSE* res dist/Rack/
  59. ifeq ($(ARCH), lin)
  60. cp Rack Rack.sh dist/Rack/
  61. cp dep/lib/libsamplerate.so.0 dist/Rack/
  62. cp dep/lib/libjansson.so.4 dist/Rack/
  63. cp dep/lib/libGLEW.so.2.1 dist/Rack/
  64. cp dep/lib/libglfw.so.3 dist/Rack/
  65. cp dep/lib/libcurl.so.4 dist/Rack/
  66. cp dep/lib/libzip.so.5 dist/Rack/
  67. cp dep/lib/libportaudio.so.2 dist/Rack/
  68. cp dep/lib/libportmidi.so dist/Rack/
  69. cp dep/lib/libsamplerate.so.0 dist/Rack/
  70. cp dep/lib/libsamplerate.so.0 dist/Rack/
  71. endif
  72. ifeq ($(ARCH), mac)
  73. mkdir -p $(BUNDLE)
  74. mkdir -p $(BUNDLE)/Contents
  75. mkdir -p $(BUNDLE)/Contents/Resources
  76. cp Info.plist $(BUNDLE)/Contents/
  77. mkdir -p $(BUNDLE)/Contents/MacOS
  78. cp Rack $(BUNDLE)/Contents/MacOS/
  79. cp icon.icns $(BUNDLE)/Contents/Resources/
  80. otool -L $(BUNDLE)/Contents/MacOS/Rack
  81. cp dep/lib/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/
  82. cp dep/lib/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/
  83. cp dep/lib/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/
  84. cp dep/lib/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/
  85. cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/
  86. cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/
  87. cp dep/lib/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/
  88. cp dep/lib/libportmidi.dylib $(BUNDLE)/Contents/MacOS/
  89. install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/Rack
  90. install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/Rack
  91. install_name_tool -change $(PWD)/dep/lib/libjansson.4.dylib @executable_path/libjansson.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  92. install_name_tool -change $(PWD)/dep/lib/libsamplerate.0.dylib @executable_path/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/Rack
  93. install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/Rack
  94. install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/Rack
  95. install_name_tool -change $(PWD)/dep/lib/libportaudio.2.dylib @executable_path/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/Rack
  96. install_name_tool -change @rpath/libportmidi.dylib @executable_path/libportmidi.dylib $(BUNDLE)/Contents/MacOS/Rack
  97. otool -L $(BUNDLE)/Contents/MacOS/Rack
  98. cp -R Rack.app dist/Rack/
  99. endif
  100. ifeq ($(ARCH), win)
  101. # TODO Copy dlls
  102. cp Rack/*.dll dist/Rack/
  103. cp Rack/Rack.exe dist/Rack/
  104. endif
  105. # Fundamental
  106. $(MAKE) -C plugins/Fundamental dist
  107. cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/
  108. ifeq ($(ARCH), mac)
  109. cd dist && ln -s /Applications Applications
  110. cd dist && hdiutil create -srcfolder . -volname Rack -ov -format UDZO Rack-$(VERSION)-$(ARCH).dmg
  111. else
  112. cd dist && zip -5 -r Rack-$(VERSION)-$(ARCH).zip Rack
  113. endif