2024-02-22 11:31:35 +00:00
|
|
|
#
|
|
|
|
# Tibia
|
|
|
|
#
|
|
|
|
# Copyright (C) 2023, 2024 Orastron Srl unipersonale
|
|
|
|
#
|
|
|
|
# Tibia is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
# Tibia is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Tibia. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# File author: Stefano D'Angelo
|
|
|
|
#
|
|
|
|
|
2023-12-11 17:54:54 +00:00
|
|
|
include vars.mk
|
|
|
|
|
2024-01-30 14:41:30 +00:00
|
|
|
ifeq ($(OS), Windows_NT)
|
|
|
|
DLL_SUFFIX = .vst3
|
|
|
|
PLATFORM = x86_64-win
|
2024-01-30 17:02:41 +00:00
|
|
|
VST3DIR = $(shell echo '${COMMONPROGRAMFILES}' | sed 's:\\:/:g')/VST3
|
|
|
|
VST3DIR_USER = $(shell echo '${LOCALAPPDATA}' | sed 's:\\:/:g')/Programs/Common/VST3
|
2024-01-30 14:41:30 +00:00
|
|
|
CC = gcc
|
2024-02-02 16:44:58 +00:00
|
|
|
CXX = g++
|
2024-01-30 14:41:30 +00:00
|
|
|
else
|
|
|
|
UNAME_S = $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S), Darwin)
|
|
|
|
DLL_SUFFIX =
|
|
|
|
PLATFORM = MacOS
|
|
|
|
VST3DIR = /Library/Audio/Plug-Ins/VST3
|
|
|
|
VST3DIR_USER = ${HOME}/Library/Audio/Plug-Ins/VST3
|
|
|
|
CC = clang
|
2024-02-02 16:44:58 +00:00
|
|
|
CXX = clang++
|
2024-01-30 14:41:30 +00:00
|
|
|
else
|
|
|
|
DLL_SUFFIX = .so
|
|
|
|
PLATFORM = $(shell uname -m)-linux
|
|
|
|
VST3DIR = /usr/local/lib/vst3
|
|
|
|
VST3DIR_USER = ${HOME}/.vst3
|
|
|
|
CC = gcc
|
2024-02-02 16:44:58 +00:00
|
|
|
CXX = g++
|
2024-01-30 14:41:30 +00:00
|
|
|
endif
|
|
|
|
endif
|
2024-01-23 14:18:39 +00:00
|
|
|
|
2024-02-01 08:15:00 +00:00
|
|
|
COMMON_DIR := $(or $(COMMON_DIR),.)
|
|
|
|
DATA_DIR := $(or $(DATA_DIR),.)
|
|
|
|
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
|
|
|
|
|
2024-01-31 08:14:18 +00:00
|
|
|
CFLAGS = -O3 -Wall -Wpedantic -Wextra
|
2024-02-01 08:15:00 +00:00
|
|
|
CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -fPIC ${CFLAGS} ${CFLAGS_EXTRA}
|
2024-01-31 08:14:18 +00:00
|
|
|
|
|
|
|
LDFLAGS =
|
|
|
|
LDFLAGS_ALL = -shared -lm ${LDFLAGS} ${LDFLAGS_EXTRA}
|
2023-12-11 17:54:54 +00:00
|
|
|
|
2024-02-02 11:02:42 +00:00
|
|
|
CXXFLAGS = ${CFLAGS}
|
|
|
|
CXXFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -fPIC ${CXXFLAGS} ${CXXFLAGS_EXTRA}
|
|
|
|
|
2024-02-01 17:16:03 +00:00
|
|
|
ifeq ($(UNAME_S), Darwin)
|
|
|
|
CFLAGS_ALL := ${CFLAGS_ALL} -arch arm64 -arch x86_64
|
|
|
|
LDFLAGS_ALL := ${LDFLAGS_ALL} -arch arm64 -arch x86_64
|
2024-02-02 11:02:42 +00:00
|
|
|
CXXFLAGS_ALL := ${CXXFLAGS_ALL} -arch arm64 -arch x86_64
|
2024-02-01 17:16:03 +00:00
|
|
|
endif
|
|
|
|
|
2024-05-10 15:54:13 +00:00
|
|
|
ifeq ($(UNAME_S), Linux)
|
|
|
|
ifeq (${HAS_UI}, yes)
|
|
|
|
CFLAGS_ALL := ${CFLAGS_ALL} $(shell pkg-config --cflags x11)
|
|
|
|
LDFLAGS_ALL := ${LDFLAGS_ALL} $(shell pkg-config --libs x11)
|
|
|
|
CXXFLAGS_ALL := ${CXXFLAGS_ALL} $(shell pkg-config --cflags x11)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2023-12-11 17:54:54 +00:00
|
|
|
BUNDLE_DIR = ${BUNDLE_NAME}.vst3
|
|
|
|
|
2024-01-30 14:41:30 +00:00
|
|
|
DLL_DIR = Contents/${PLATFORM}
|
|
|
|
DLL_FILE = ${DLL_DIR}/${BUNDLE_NAME}${DLL_SUFFIX}
|
2023-12-11 17:54:54 +00:00
|
|
|
|
2024-02-02 11:02:42 +00:00
|
|
|
C_SRCS = ${COMMON_DIR}/src/vst3.c ${C_SRCS_EXTRA}
|
2024-02-01 19:48:22 +00:00
|
|
|
C_OBJS = $(addprefix build/obj/, $(notdir $(C_SRCS:.c=.o)))
|
|
|
|
|
2024-02-02 11:02:42 +00:00
|
|
|
CXX_SRCS = ${CXX_SRCS_EXTRA}
|
|
|
|
CXX_OBJS = $(addprefix build/obj/, $(notdir $(CXX_SRCS:.cpp=.o)))
|
2024-01-30 14:41:30 +00:00
|
|
|
|
2024-02-02 11:02:42 +00:00
|
|
|
ifeq ($(UNAME_S), Darwin)
|
2024-05-30 13:38:13 +00:00
|
|
|
all: build/${BUNDLE_DIR}/${DLL_FILE} build/${BUNDLE_DIR}/Contents/Info.plist build/${BUNDLE_DIR}/Contents/PkgInfo
|
2023-12-11 17:54:54 +00:00
|
|
|
|
2024-05-30 13:38:13 +00:00
|
|
|
build/${BUNDLE_DIR}/Contents/%: ${DATA_DIR}/data/% | build/${BUNDLE_DIR}/Contents
|
2023-12-11 17:54:54 +00:00
|
|
|
cp $^ $@
|
2024-01-30 14:41:30 +00:00
|
|
|
else
|
|
|
|
all: build/${BUNDLE_DIR}/${DLL_FILE}
|
2024-02-01 17:10:53 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-02 11:02:42 +00:00
|
|
|
ifeq ($(CXX_OBJS),)
|
2024-02-01 19:48:22 +00:00
|
|
|
build/${BUNDLE_DIR}/${DLL_FILE}: ${C_OBJS} | build/${BUNDLE_DIR}/${DLL_DIR}
|
|
|
|
${CC} $^ -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL}
|
2024-02-02 11:02:42 +00:00
|
|
|
else
|
|
|
|
build/${BUNDLE_DIR}/${DLL_FILE}: ${C_OBJS} ${CXX_OBJS} | build/${BUNDLE_DIR}/${DLL_DIR}
|
|
|
|
${CXX} $^ -o $@ ${CFLAGS_ALL} ${CXXFLAGS_ALL} ${LDFLAGS_ALL}
|
|
|
|
endif
|
2023-12-11 17:54:54 +00:00
|
|
|
|
2024-02-01 19:48:22 +00:00
|
|
|
build/${BUNDLE_DIR}/${DLL_DIR} build/obj:
|
2023-12-11 17:54:54 +00:00
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -fr build
|
|
|
|
|
2024-01-30 14:41:30 +00:00
|
|
|
ifeq ($(UNAME_S), Darwin)
|
|
|
|
|
|
|
|
install: all
|
|
|
|
mkdir -p -m 0755 "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
install -m 0644 build/${BUNDLE_DIR}/Contents/Info.plist "${VST3DIR}/${BUNDLE_DIR}/Contents/Info.plist"
|
2024-05-30 13:38:13 +00:00
|
|
|
install -m 0644 build/${BUNDLE_DIR}/Contents/PkgInfo "${VST3DIR}/${BUNDLE_DIR}/Contents/PkgInfo"
|
2024-01-30 14:41:30 +00:00
|
|
|
|
|
|
|
install-user: all
|
|
|
|
mkdir -p -m 0755 "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
install -m 0644 build/${BUNDLE_DIR}/Contents/Info.plist "${VST3DIR_USER}/${BUNDLE_DIR}/Contents/Info.plist"
|
2024-05-30 13:38:13 +00:00
|
|
|
install -m 0644 build/${BUNDLE_DIR}/Contents/PkgInfo "${VST3DIR_USER}/${BUNDLE_DIR}/Contents/PkgInfo"
|
2024-01-30 14:41:30 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
install: all
|
|
|
|
mkdir -p -m 0755 "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
|
|
|
|
install-user: all
|
|
|
|
mkdir -p -m 0755 "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} "${VST3DIR_USER}/${BUNDLE_DIR}/${DLL_DIR}"
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: all clean install install-user
|
2024-02-02 11:02:42 +00:00
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
|
|
|
PERCENT := %
|
|
|
|
|
|
|
|
$(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$(C_SRCS)) | build/obj
|
|
|
|
${CC} $^ -o $@ -c ${CFLAGS_ALL}
|
|
|
|
|
|
|
|
$(CXX_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).cpp,$$(CXX_SRCS)) | build/obj
|
|
|
|
${CXX} $^ -o $@ -c ${CXXFLAGS_ALL}
|