|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- RACK_DIR ?= .
- EDITION := CE
- EDITION_NAME := Community Edition
- VERSION_MAJOR := 2
- VERSION := 2.dev.$(shell git rev-parse --short HEAD)
- # VERSION := 2.0.0
-
- FLAGS += -DVERSION=$(VERSION)
- FLAGS += -Iinclude -Idep/include
-
- include arch.mk
-
- # Sources and build flags
-
- SOURCES += dep/nanovg/src/nanovg.c
- SOURCES += dep/osdialog/osdialog.c
- SOURCES += dep/oui-blendish/blendish.c
- SOURCES += dep/pffft/pffft.c dep/pffft/fftpack.c
- SOURCES += $(wildcard src/*.c src/*/*.c)
- SOURCES += $(wildcard src/*.cpp src/*/*.cpp)
-
- STANDALONE_SOURCES += adapters/standalone.cpp
-
- FLAGS += -fPIC
- LDFLAGS += -shared
-
- ifdef ARCH_LIN
- SED := sed -i
- TARGET := libRack.so
-
- SOURCES += dep/osdialog/osdialog_gtk3.c
- build/dep/osdialog/osdialog_gtk3.c.o: FLAGS += $(shell pkg-config --cflags gtk+-3.0)
-
- # This prevents static variables in the DSO (dynamic shared object) from being preserved after dlclose().
- # I don't really understand the side effects (see GCC manual), but so far tests are positive.
- FLAGS += -fno-gnu-unique
-
- LDFLAGS += -Wl,--whole-archive
- LDFLAGS += dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a
- LDFLAGS += -Wl,--no-whole-archive
- LDFLAGS += -lpthread -lGL -ldl -lX11 -lasound -ljack
- LDFLAGS += $(shell pkg-config --libs gtk+-3.0)
-
- STANDALONE_TARGET := Rack
- STANDALONE_LDFLAGS += -Wl,-rpath=.
- endif
-
- ifdef ARCH_MAC
- SED := sed -i ''
- TARGET := libRack.dylib
-
- SOURCES += dep/osdialog/osdialog_mac.m
- LDFLAGS += -lpthread -ldl
- LDFLAGS += -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -framework CoreAudio -framework CoreMIDI
- LDFLAGS += -Wl,-all_load
- LDFLAGS += dep/lib/libGLEW.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/librtmidi.a dep/lib/librtaudio.a
-
- STANDALONE_TARGET := Rack
- STANDALONE_LDFLAGS += -stdlib=libc++
- # For LuaJIT to work inside plugins
- STANDALONE_LDFLAGS += -Wl,-pagezero_size,10000 -Wl,-image_base,100000000
- endif
-
- ifdef ARCH_WIN
- SED := sed -i
- TARGET := libRack.dll
-
- SOURCES += dep/osdialog/osdialog_win.c
- LDFLAGS += -municode
- LDFLAGS += -Wl,--export-all-symbols
- LDFLAGS += -Wl,--out-implib,$(TARGET).a
- LDFLAGS += -Wl,-Bstatic -Wl,--whole-archive
- LDFLAGS += dep/lib/libglew32.a dep/lib/libglfw3.a dep/lib/libjansson.a dep/lib/libspeexdsp.a dep/lib/libsamplerate.a dep/lib/libarchive.a dep/lib/libzstd.a dep/lib/libcurl.a dep/lib/libssl.a dep/lib/libcrypto.a dep/lib/librtaudio.a dep/lib/librtmidi.a
- LDFLAGS += -Wl,-Bdynamic -Wl,--no-whole-archive
- LDFLAGS += -lpthread -lopengl32 -lgdi32 -lws2_32 -lcomdlg32 -lole32 -ldsound -lwinmm -lksuser -lshlwapi -lmfplat -lmfuuid -lwmcodecdspuuid -ldbghelp
-
- STANDALONE_TARGET := Rack.exe
- STANDALONE_LDFLAGS += -mwindows
- STANDALONE_OBJECTS += build/Rack.res
- endif
-
- include compile.mk
-
- # Standalone adapter
-
- ifdef ARCH_MAC
- STANDALONE_LDFLAGS += $(MAC_SDK_FLAGS)
- endif
- STANDALONE_OBJECTS += $(TARGET)
- -include $(STANDALONE_DEPENDENCIES)
-
- $(STANDALONE_TARGET): $(STANDALONE_OBJECTS) $(STANDALONE_SOURCES)
- $(CXX) $(CXXFLAGS) -o $@ $^ $(STANDALONE_LDFLAGS)
-
- # Convenience targets
-
- all: $(TARGET) $(STANDALONE_TARGET)
-
- dep:
- $(MAKE) -C dep
-
- run: $(STANDALONE_TARGET)
- ./$< -d
-
- runr: $(STANDALONE_TARGET)
- ./$<
-
- debug: $(STANDALONE_TARGET)
- ifdef ARCH_MAC
- lldb -- ./$< -d
- endif
- ifdef ARCH_WIN
- gdb --args ./$< -d
- endif
- ifdef ARCH_LIN
- gdb --args ./$< -d
- endif
-
- screenshot: $(STANDALONE_TARGET)
- ./$< -d -t 2
-
- perf: $(STANDALONE_TARGET)
- # Requires perf
- perf record --call-graph dwarf -o perf.data ./$< -d
- # Analyze with hotspot (https://github.com/KDAB/hotspot) for example
- hotspot perf.data
- rm perf.data
-
- valgrind: $(STANDALONE_TARGET)
- # --gen-suppressions=yes
- # --leak-check=full
- valgrind --suppressions=valgrind.supp ./$< -d
-
- clean:
- rm -rfv build dist *.a Rack.res *.d $(TARGET) $(STANDALONE_TARGET)
-
-
- # For Windows resources
- build/%.res: %.rc
- ifdef ARCH_WIN
- windres $^ -O coff -o $@
- endif
-
- DIST_RES := res cacert.pem Core.json template.vcv LICENSE-GPLv3.txt
- DIST_NAME := Rack-$(EDITION)-"$(VERSION)"-$(ARCH)
- DIST_SDK_DIR := Rack-SDK
- DIST_SDK := Rack-SDK-$(VERSION).zip
- ifdef ARCH_MAC
- DIST_BUNDLE := VCV Rack $(EDITION) $(VERSION_MAJOR).app
- else
- DIST_DIR := Rack$(EDITION)$(VERSION_MAJOR)
- endif
- DIST_MD := $(wildcard *.md)
- DIST_HTML := $(patsubst %.md, build/%.html, $(DIST_MD))
-
-
- # This target is not supported for public use
- dist: $(TARGET) $(STANDALONE_TARGET) $(DIST_HTML)
- rm -rf dist
- mkdir -p dist
-
- # Copy Rack to dist
- ifdef ARCH_LIN
- mkdir -p dist/"$(DIST_DIR)"
- cp $(TARGET) dist/"$(DIST_DIR)"/
- cp $(STANDALONE_TARGET) dist/"$(DIST_DIR)"/
- $(STRIP) -s dist/"$(DIST_DIR)"/$(TARGET)
- $(STRIP) -s dist/"$(DIST_DIR)"/$(STANDALONE_TARGET)
- # Manually check that no nonstandard shared libraries are linked
- ldd dist/"$(DIST_DIR)"/$(TARGET)
- ldd dist/"$(DIST_DIR)"/$(STANDALONE_TARGET)
- # Copy resources
- cp -R $(DIST_RES) dist/"$(DIST_DIR)"/
- cp $(DIST_HTML) dist/"$(DIST_DIR)"/
- cp plugins/Fundamental/dist/Fundamental-*.vcvplugin dist/"$(DIST_DIR)"/Fundamental.vcvplugin
- # Make ZIP
- cd dist && zip -q -9 -r $(DIST_NAME).zip $(DIST_DIR)
- endif
- ifdef ARCH_MAC
- mkdir -p dist/"$(DIST_BUNDLE)"
- mkdir -p dist/"$(DIST_BUNDLE)"/Contents
- mkdir -p dist/"$(DIST_BUNDLE)"/Contents/Resources
- mkdir -p dist/"$(DIST_BUNDLE)"/Contents/MacOS
- cp $(TARGET) dist/"$(DIST_BUNDLE)"/Contents/Resources/
- cp $(STANDALONE_TARGET) dist/"$(DIST_BUNDLE)"/Contents/MacOS/
- $(STRIP) -S dist/"$(DIST_BUNDLE)"/Contents/Resources/$(TARGET)
- $(STRIP) -S dist/"$(DIST_BUNDLE)"/Contents/MacOS/$(STANDALONE_TARGET)
- install_name_tool -change $(TARGET) @executable_path/../Resources/$(TARGET) dist/"$(DIST_BUNDLE)"/Contents/MacOS/$(STANDALONE_TARGET)
- # Manually check that no nonstandard shared libraries are linked
- otool -L dist/"$(DIST_BUNDLE)"/Contents/Resources/$(TARGET)
- otool -L dist/"$(DIST_BUNDLE)"/Contents/MacOS/$(STANDALONE_TARGET)
- # Copy resources
- cp Info.plist dist/"$(DIST_BUNDLE)"/Contents/
- $(SED) 's/{VERSION}/$(VERSION)/g' dist/"$(DIST_BUNDLE)"/Contents/Info.plist
- cp -R $(DIST_RES) dist/"$(DIST_BUNDLE)"/Contents/Resources/
- cp $(DIST_HTML) dist/"$(DIST_BUNDLE)"/Contents/Resources/
- cp -R icon.icns dist/"$(DIST_BUNDLE)"/Contents/Resources/
- cp plugins/Fundamental/dist/Fundamental-*.vcvplugin dist/"$(DIST_BUNDLE)"/Fundamental.vcvplugin
- # Clean up and sign bundle
- xattr -cr dist/"$(DIST_BUNDLE)"
- # This will only work if you have the private key to my certificate
- codesign --verbose --sign "Developer ID Application: Andrew Belt (VRF26934X5)" --options runtime --entitlements Entitlements.plist --deep dist/"$(DIST_BUNDLE)"
- codesign --verify --deep --strict --verbose=2 dist/"$(DIST_BUNDLE)"
- # Make ZIP
- cd dist && zip -q -9 -r $(DIST_NAME).zip "$(DIST_BUNDLE)"
- endif
- ifdef ARCH_WIN
- mkdir -p dist/"$(DIST_DIR)"
- cp $(TARGET) dist/"$(DIST_DIR)"/
- cp $(STANDALONE_TARGET) dist/"$(DIST_DIR)"/
- $(STRIP) -s dist/"$(DIST_DIR)"/$(TARGET)
- $(STRIP) -s dist/"$(DIST_DIR)"/$(STANDALONE_TARGET)
- # Copy resources
- cp -R $(DIST_RES) dist/"$(DIST_DIR)"/
- cp $(DIST_HTML) dist/"$(DIST_DIR)"/
- cp /mingw64/bin/libwinpthread-1.dll dist/"$(DIST_DIR)"/
- cp /mingw64/bin/libstdc++-6.dll dist/"$(DIST_DIR)"/
- cp /mingw64/bin/libgcc_s_seh-1.dll dist/"$(DIST_DIR)"/
- cp plugins/Fundamental/dist/Fundamental-*.vcvplugin dist/"$(DIST_DIR)"/Fundamental.vcvplugin
- # Make ZIP
- cd dist && zip -q -9 -r $(DIST_NAME).zip "$(DIST_DIR)"
- # Make NSIS installer
- # pacman -S mingw-w64-x86_64-nsis
- makensis -DEDITION="$(EDITION)" -DEDITION_NAME="$(EDITION_NAME)" -DVERSION_MAJOR="$(VERSION_MAJOR)" -DVERSION="$(VERSION)" "-XOutFile dist/$(DIST_NAME).exe" installer.nsi
- endif
-
- # Build Rack SDK
- mkdir -p dist/"$(DIST_SDK_DIR)"
- cp -R LICENSE* *.mk include helper.py dist/"$(DIST_SDK_DIR)"/
- mkdir -p dist/"$(DIST_SDK_DIR)"/dep/
- cp -R dep/include dist/"$(DIST_SDK_DIR)"/dep/
- ifdef ARCH_WIN
- cp libRack.dll.a dist/"$(DIST_SDK_DIR)"/
- endif
- cd dist && zip -q -9 -r $(DIST_SDK) "$(DIST_SDK_DIR)"
-
-
- notarize:
- ifdef ARCH_MAC
- # This will only work if you have my Apple ID password in your keychain
- xcrun altool --notarize-app -f dist/"$(DIST_BUNDLE)"-"$(VERSION)"-$(ARCH).zip --primary-bundle-id=com.vcvrack.rack -u "andrewpbelt@gmail.com" -p @keychain:notarize --output-format xml > dist/UploadInfo.plist
- # Wait for Apple's servers to approve the app
- while true; do \
- echo "Waiting on Apple servers..." ; \
- xcrun altool --notarization-info `/usr/libexec/PlistBuddy -c "Print :notarization-upload:RequestUUID" dist/UploadInfo.plist` -u "andrewpbelt@gmail.com" -p @keychain:notarize --output-format xml > dist/RequestInfo.plist ; \
- if [ "`/usr/libexec/PlistBuddy -c "Print :notarization-info:Status" dist/RequestInfo.plist`" != "in progress" ]; then \
- break ; \
- fi ; \
- sleep 10 ; \
- done
- # Mark app as notarized, check, and re-zip
- xcrun stapler staple dist/"$(DIST_BUNDLE)"
- spctl --assess --type execute --ignore-cache --no-cache -vv dist/"$(DIST_BUNDLE)"
- cd dist && zip -q -9 -r "$(DIST_NAME)".zip "$(DIST_BUNDLE)"
- endif
-
-
- # Plugin helpers
-
- plugins:
- ifdef CMD
- for f in plugins/*; do (cd "$$f" && $(CMD)); done
- else
- for f in plugins/*; do $(MAKE) -C "$$f"; done
- endif
-
-
- # Includes
-
- .DEFAULT_GOAL := all
- .PHONY: all dep run debug clean dist upload src plugins
|