wavetable/Makefile
Armin 70c2b83798 make: check submodules before configuring
CMakePresets.json includes the gin toolchain presets, so configuring
fails with a bare "File not found" when the submodules are missing or a
git submodule update is in flight. Report the missing path and the fix
instead.
2026-10-03 17:49:24 +02:00

102 lines
No EOL
4.3 KiB
Makefile

# 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 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 the submodules are missing or mid-update.
SUBMODULE_GUARD = for f in $(SUBMODULE_FILES); do test -e "$$f" || { echo "Missing $$f"; echo "Run: git submodule update --init --recursive"; exit 1; }; 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)
cmake --preset $(PRESET)
build: $(CACHE)
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