#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

pdlibdir = /usr/lib/pd
llvmconfig = $(wildcard /usr/bin/llvm-config-*)
LLVMLIBS = $(shell $(llvmconfig) --ldflags --link-shared --libs)

%:
	dh $@

override_dh_auto_configure:

override_dh_auto_clean:
	rm -rf build

override_dh_auto_build:
	mkdir -p build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX="$(pdlibdir)" -DINSTALL_DIR="extra/faustgen2~" -DUSE_LLVM_CONFIG=off -Dllvm_libs="$(LLVMLIBS)" && make
	strip --strip-unneeded external/faustgen2~.pd_linux

override_dh_auto_install:
	cd build && make install DESTDIR="$(CURDIR)/debian/pd-faustgen2"

override_dh_compress:
	dh_compress -X.pd -X.lib -X.dsp -X.scl -X.md
