# Convenience Makefile for Wavetable # Builds via CMake presets (see CMakePresets.json), then installs the plugin # bundles into ~/Library/Audio/Plug-Ins and the factory resources into # /Library/Audio/Presets (see the PRESET_ROOT note below). .PHONY: all configure check-submodules apply-patches build clean install uninstall uninstall-system pkg PRESET ?= $(shell \ if command -v xcodebuild >/dev/null 2>&1 && xcodebuild -version >/dev/null 2>&1; then \ echo xcode; \ else \ echo macos; \ fi) CONFIG ?= Release PLUGIN = Wavetable VENDOR = SocaLabs BUILD_DIR = Builds/$(PRESET) CACHE = $(BUILD_DIR)/CMakeCache.txt ARTEFACTS = $(BUILD_DIR)/$(PLUGIN)_artefacts/$(CONFIG) STAGE = $(BUILD_DIR)/install-stage SUBMODULE_FILES = modules/gin/ci/toolchains/base.json \ modules/gin/ci/toolchains/xcode.json \ modules/juce/CMakeLists.txt # CMakePresets.json includes the gin toolchain presets, so configuring dies with # a bare "File not found" if a module directory is missing or half-deleted. # modules/ is gitignored and has no gitlink entries in the index, so # "git submodule update" is a no-op here and cannot restore anything. SUBMODULE_GUARD = for f in $(SUBMODULE_FILES); do test -e "$$f" || { m=`echo $$f | cut -d/ -f1-2`; r=`echo $$f | sed 's|^[^/]*/[^/]*/||'`; echo "Missing $$f"; echo " restore one file: git -C $$m checkout -- $$r"; echo " whole module: git clone $$m"; echo " note: 'git submodule update' is a no-op, modules/ is gitignored"; exit 1; }; done # Local modifications to Gin live in patches/ (modules/ is gitignored, so the # changes cannot be committed as submodule edits). Re-applied on every build; # idempotent - patches already in the tree are skipped. PATCHES = $(wildcard patches/*.patch) apply-patches: @test -d modules/gin/.git || { echo "modules/gin missing - see 'make check-submodules'"; exit 1; } @for p in $(PATCHES); do \ if git -C modules/gin apply --reverse --check "$(CURDIR)/$$p" >/dev/null 2>&1; then \ echo "Patch already applied: $$p"; \ elif git -C modules/gin apply --check "$(CURDIR)/$$p" >/dev/null 2>&1; then \ git -C modules/gin apply "$(CURDIR)/$$p" && echo "Applied: $$p"; \ else \ echo "Cannot apply $$p to modules/gin (upstream changed?)"; exit 1; \ fi; \ done # Bundles go in the user directory so no sudo is needed and hosts prefer them. PLUGIN_ROOT = $(HOME)/Library/Audio/Plug-Ins # Factory presets and wavetables are only ever read from the system resource # root on macOS (see systemResourceRoot() in PluginProcessor.cpp), so they have # to go to /Library and need sudo. SYSTEM_PLUGIN_ROOT = /Library/Audio/Plug-Ins PRESET_ROOT = /Library/Audio/Presets/$(VENDOR)/$(PLUGIN) all: build configure: $(CACHE) check-submodules: @$(SUBMODULE_GUARD) @echo "Submodules look complete." $(CACHE): @$(SUBMODULE_GUARD) @$(MAKE) --no-print-directory apply-patches cmake --preset $(PRESET) build: $(CACHE) @$(MAKE) --no-print-directory apply-patches cmake --build --preset $(PRESET) --config $(CONFIG) clean: cmake --build --preset $(PRESET) --target clean 2>/dev/null || true rm -rf $(BUILD_DIR) install: build @if [ -d "$(SYSTEM_PLUGIN_ROOT)/Components/$(PLUGIN).component" ] || [ -d "$(SYSTEM_PLUGIN_ROOT)/VST3/$(PLUGIN).vst3" ]; then \ echo "WARNING: an older system-wide install still exists in $(SYSTEM_PLUGIN_ROOT)."; \ echo " Hosts may load that one instead - run 'make uninstall-system'."; \ fi @test -d "$(ARTEFACTS)/AU/$(PLUGIN).component" || { echo "Missing AU artefact in $(ARTEFACTS)"; exit 1; } @test -d "$(ARTEFACTS)/VST3/$(PLUGIN).vst3" || { echo "Missing VST3 artefact in $(ARTEFACTS)"; exit 1; } @test -d "$(ARTEFACTS)/CLAP/$(PLUGIN).clap" || { echo "Missing CLAP artefact in $(ARTEFACTS)"; exit 1; } @echo "Staging $(CONFIG) artefacts..." @rm -rf $(STAGE) @mkdir -p $(STAGE)/Components $(STAGE)/VST3 $(STAGE)/CLAP $(STAGE)/Presets $(STAGE)/Wavetables @cp -R "$(ARTEFACTS)/AU/$(PLUGIN).component" $(STAGE)/Components/ @cp -R "$(ARTEFACTS)/VST3/$(PLUGIN).vst3" $(STAGE)/VST3/ @cp -R "$(ARTEFACTS)/CLAP/$(PLUGIN).clap" $(STAGE)/CLAP/ @find plugin/Resources/Presets -name '*.xml' -type f -exec cp {} $(STAGE)/Presets/ \; @cp -R plugin/Resources/WavetablesFLAC/. $(STAGE)/Wavetables/ @echo "Installing bundles to $(PLUGIN_ROOT)..." @mkdir -p $(PLUGIN_ROOT)/Components $(PLUGIN_ROOT)/VST3 $(PLUGIN_ROOT)/CLAP @rsync -a --delete "$(STAGE)/Components/$(PLUGIN).component/" "$(PLUGIN_ROOT)/Components/$(PLUGIN).component/" @rsync -a --delete "$(STAGE)/VST3/$(PLUGIN).vst3/" "$(PLUGIN_ROOT)/VST3/$(PLUGIN).vst3/" @rsync -a --delete "$(STAGE)/CLAP/$(PLUGIN).clap/" "$(PLUGIN_ROOT)/CLAP/$(PLUGIN).clap/" @echo "Installing resources to $(PRESET_ROOT)..." sudo mkdir -p $(PRESET_ROOT)/Presets $(PRESET_ROOT)/Wavetables sudo rsync -a --delete "$(STAGE)/Presets/" "$(PRESET_ROOT)/Presets/" sudo rsync -a --delete "$(STAGE)/Wavetables/" "$(PRESET_ROOT)/Wavetables/" @echo "Done. Restart your DAW to load the new binary." uninstall: rm -rf $(PLUGIN_ROOT)/Components/$(PLUGIN).component rm -rf $(PLUGIN_ROOT)/VST3/$(PLUGIN).vst3 rm -rf $(PLUGIN_ROOT)/CLAP/$(PLUGIN).clap rm -rf $(HOME)/Library/Audio/Presets/$(VENDOR)/$(PLUGIN) # Removes the older system-wide install, otherwise hosts may keep loading it # instead of the copy in ~/Library. uninstall-system: sudo rm -rf $(SYSTEM_PLUGIN_ROOT)/Components/$(PLUGIN).component sudo rm -rf $(SYSTEM_PLUGIN_ROOT)/VST3/$(PLUGIN).vst3 sudo rm -rf $(SYSTEM_PLUGIN_ROOT)/CLAP/$(PLUGIN).clap sudo rm -rf $(PRESET_ROOT) pkg: ./Installer/build.sh