2024-01-05 13:45:14 +00:00
|
|
|
include vars.mk
|
|
|
|
|
2024-01-30 08:56:00 +00:00
|
|
|
ifeq ($(OS), Windows_NT)
|
|
|
|
DLL_SUFFIX = .dll
|
|
|
|
COMMONPROGRAMFILES = $(shell echo '${COMMONPROGRAMFILES}' | sed 's:\\:/:g')
|
|
|
|
APPDATA = $(shell echo '${APPDATA}' | sed 's:\\:/:g')
|
|
|
|
LV2DIR = ${COMMONPROGRAMFILES}/LV2
|
|
|
|
LV2DIR_USER = ${APPDATA}/LV2
|
2024-01-30 14:41:30 +00:00
|
|
|
CC = gcc
|
2024-01-30 08:56:00 +00:00
|
|
|
else
|
|
|
|
UNAME_S = $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S), Darwin)
|
|
|
|
DLL_SUFFIX = .dylib
|
|
|
|
LV2DIR = /Library/Audio/Plug-Ins/LV2
|
|
|
|
LV2DIR_USER = ${HOME}/Library/Audio/Plug-Ins/LV2
|
2024-01-30 14:41:30 +00:00
|
|
|
CC = clang
|
2024-01-30 08:56:00 +00:00
|
|
|
else
|
|
|
|
DLL_SUFFIX = .so
|
|
|
|
PREFIX = /usr/local
|
|
|
|
LV2DIR = ${PREFIX}/lib/lv2
|
|
|
|
LV2DIR_USER = ${HOME}/.lv2
|
2024-01-30 14:41:30 +00:00
|
|
|
CC = gcc
|
2024-01-30 08:56:00 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2024-01-30 14:41:30 +00:00
|
|
|
CFLAGS = -O3 -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
|
2024-01-23 14:18:39 +00:00
|
|
|
LDFLAGS = -shared
|
2024-01-05 13:45:14 +00:00
|
|
|
|
|
|
|
BUNDLE_DIR = ${BUNDLE_NAME}.lv2
|
|
|
|
|
2024-01-30 08:56:00 +00:00
|
|
|
DLL_FILE = ${BUNDLE_NAME}${DLL_SUFFIX}
|
2024-01-05 13:45:14 +00:00
|
|
|
|
2024-01-30 08:56:00 +00:00
|
|
|
all: build/${BUNDLE_DIR}/manifest.ttl build/${BUNDLE_DIR}/${DLL_FILE}
|
2024-01-05 13:45:14 +00:00
|
|
|
|
2024-01-30 08:56:00 +00:00
|
|
|
build/${BUNDLE_DIR}/manifest.ttl: data/manifest.ttl.in | build/${BUNDLE_DIR}
|
|
|
|
cat $^ | sed s/@DLL_SUFFIX@/${DLL_SUFFIX}/g > $@
|
2024-01-05 13:45:14 +00:00
|
|
|
|
2024-01-30 14:41:30 +00:00
|
|
|
ifeq ($(UNAME_S), Darwin)
|
|
|
|
|
|
|
|
build/${BUNDLE_DIR}/${DLL_FILE}: build/tmp/x86_64 build/tmp/arm64 | build/${BUNDLE_DIR}
|
|
|
|
lipo -create -output $@ $^
|
|
|
|
|
|
|
|
build/tmp/x86_64: src/lv2.c src/data.h src/plugin.h | build/tmp
|
|
|
|
${CC} src/lv2.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA} -arch x86_64
|
|
|
|
|
|
|
|
build/tmp/arm64: src/lv2.c src/data.h src/plugin.h | build/tmp
|
|
|
|
${CC} src/lv2.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA} -arch arm64
|
|
|
|
|
|
|
|
build/tmp:
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
build/${BUNDLE_DIR}/${DLL_FILE}: src/lv2.c src/data.h | build/${BUNDLE_DIR}
|
|
|
|
${CC} src/lv2.c -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA}
|
|
|
|
|
|
|
|
endif
|
2024-01-05 13:45:14 +00:00
|
|
|
|
|
|
|
build/${BUNDLE_DIR}:
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -fr build
|
|
|
|
|
2024-01-30 08:56:00 +00:00
|
|
|
install: all
|
2024-01-30 14:41:30 +00:00
|
|
|
mkdir -p -m 0755 "${LV2DIR}/${BUNDLE_DIR}"
|
|
|
|
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl "${LV2DIR}/${BUNDLE_DIR}"
|
|
|
|
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${LV2DIR}/${BUNDLE_DIR}"
|
2024-01-30 08:56:00 +00:00
|
|
|
|
|
|
|
install-user: all
|
2024-01-30 14:41:30 +00:00
|
|
|
mkdir -p -m 0755 "${LV2DIR_USER}/${BUNDLE_DIR}"
|
|
|
|
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl "${LV2DIR_USER}/${BUNDLE_DIR}"
|
|
|
|
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${LV2DIR_USER}/${BUNDLE_DIR}"
|
2024-01-30 08:56:00 +00:00
|
|
|
|
|
|
|
.PHONY: all clean install install-user
|