towards makefile-based definitions
This commit is contained in:
parent
d8323436f1
commit
0782f8b05d
@ -18,8 +18,17 @@
|
||||
# File author: Stefano D'Angelo
|
||||
#
|
||||
|
||||
TEMPLATE := cmd
|
||||
|
||||
include vars.mk
|
||||
|
||||
COMMON_DIR ?= .
|
||||
DATA_DIR ?= .
|
||||
PLUGIN_DIR ?= src
|
||||
MKINC_DIR ?= $(COMMON_DIR)
|
||||
|
||||
-include $(MKINC_DIR)/vars-pre.mk
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXE_SUFFIX := .exe
|
||||
else
|
||||
@ -29,21 +38,20 @@ else
|
||||
BINDIR := $(PREFIX)/bin
|
||||
endif
|
||||
|
||||
COMMON_DIR := $(or $(COMMON_DIR),.)
|
||||
DATA_DIR := $(or $(DATA_DIR),.)
|
||||
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
|
||||
TINIWAV_DIR ?= ../tinywav
|
||||
MIDI_PARSER_DIR ?= ../midi-parser
|
||||
|
||||
CC := gcc
|
||||
CXX := g++
|
||||
|
||||
CFLAGS := -O3 -Wall -Wpedantic -Wextra
|
||||
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(TINYWAV_DIR) -I$(MIDI_PARSER_DIR)/include -fPIC $(CFLAGS) $(CFLAGS_EXTRA)
|
||||
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(TINYWAV_DIR) -I$(MIDI_PARSER_DIR)/include $(CFLAGS_EXTRA) $(CFLAGS)
|
||||
|
||||
LDFLAGS :=
|
||||
LDFLAGS_ALL := $(LDFLAGS) $(LDFLAGS_EXTRA)
|
||||
LDFLAGS_ALL := $(LDFLAGS_EXTRA) $(LDFLAGS)
|
||||
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(TINYWAV_DIR) -I$(MIDI_PARSER_DIR)/include -fPIC $(CXXFLAGS) $(CXXFLAGS_EXTRA)
|
||||
CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(TINYWAV_DIR) -I$(MIDI_PARSER_DIR)/include $(CXXFLAGS_EXTRA) $(CXXFLAGS)
|
||||
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
CFLAGS_ALL := $(CFLAGS_ALL) -arch arm64 -arch x86_64
|
||||
@ -64,7 +72,7 @@ CXX_OBJS := $(addprefix build/obj/, $(notdir $(CXX_SRCS:.cpp=.o)))
|
||||
|
||||
ALL := build/$(PROGRAM)
|
||||
|
||||
-include $(COMMON_DIR)/vars-extra.mk
|
||||
-include $(MKINC_DIR)/vars-extra.mk
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
@ -92,7 +100,7 @@ install: all
|
||||
.PHONY: all clean install
|
||||
endif
|
||||
|
||||
-include $(COMMON_DIR)/rules-extra.mk
|
||||
-include $(MKINC_DIR)/rules-extra.mk
|
||||
|
||||
.SECONDEXPANSION:
|
||||
|
||||
@ -107,4 +115,4 @@ $(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$
|
||||
$(CXX_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).cpp,$$(CXX_SRCS)) | build/obj
|
||||
$(CXX) $^ -o $@ -c $(CXXFLAGS_ALL)
|
||||
|
||||
-include $(COMMON_DIR)/rules-secondexp-extra.mk
|
||||
-include $(MKINC_DIR)/rules-secondexp-extra.mk
|
||||
|
@ -20,18 +20,17 @@
|
||||
|
||||
BUNDLE_NAME := {{=it.product.bundleName}}
|
||||
|
||||
CFLAGS_EXTRA := {{=it.make?.cflags ?? ""}} {{=it.cmd_make?.cflags ?? ""}}
|
||||
CXXFLAGS_EXTRA := {{=it.make?.cxxflags ?? ""}} {{=it.cmd_make?.cxxflags ?? ""}}
|
||||
LDFLAGS_EXTRA := {{=it.make?.ldflags ?? ""}} {{=it.cmd_make?.ldflags ?? ""}}
|
||||
|
||||
C_SRCS_EXTRA := {{=it.make?.cSrcs ?? ""}} {{=it.cmd_make?.cSrcs ?? ""}}
|
||||
CXX_SRCS_EXTRA := {{=it.make?.cxxSrcs ?? ""}} {{=it.cmd_make?.cxxSrcs ?? ""}}
|
||||
|
||||
{{?(it.cmd_make?.commonDir || it.make?.commonDir)}}
|
||||
COMMON_DIR := {{=it.cmd_make?.commonDir ?? (it.make?.commonDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.cmd_make?.dataDir || it.make?.dataDir)}}
|
||||
DATA_DIR := {{=it.cmd_make?.dataDir ?? (it.make?.dataDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.cmd_make?.pluginDir || it.make?.pluginDir)}}
|
||||
PLUGIN_DIR := {{=it.cmd_make?.pluginDir ?? (it.make?.pluginDir ?? "")}}
|
||||
|
||||
TINYWAV_DIR := {{=it.cmd_make.tinywavDir}}
|
||||
MIDI_PARSER_DIR := {{=it.cmd_make.midiParserDir}}
|
||||
{{?}}
|
||||
{{?(it.cmd_make?.mkincDir || it.make?.mkincDir)}}
|
||||
MKINC_DIR := {{=it.cmd_make?.mkincDir ?? (it.make?.mkincDir ?? "")}}
|
||||
{{?}}
|
||||
|
||||
HAS_MIDI_IN := {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "input").length > 0 ? "yes" : "no"}}
|
||||
|
@ -43,6 +43,7 @@ enum {
|
||||
{{~it.product.parameters :p}}
|
||||
plugin_parameter_{{=p.id}},
|
||||
{{~}}
|
||||
plugin_parameter__count
|
||||
};
|
||||
{{?}}
|
||||
|
||||
|
@ -18,8 +18,17 @@
|
||||
# File author: Stefano D'Angelo
|
||||
#
|
||||
|
||||
TEMPLATE := lv2
|
||||
|
||||
include vars.mk
|
||||
|
||||
COMMON_DIR ?= .
|
||||
DATA_DIR ?= .
|
||||
PLUGIN_DIR ?= src
|
||||
MKINC_DIR ?= $(COMMON_DIR)
|
||||
|
||||
-include $(MKINC_DIR)/vars-pre.mk
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
DLL_SUFFIX := .dll
|
||||
UI_TYPE := WindowsUI
|
||||
@ -47,18 +56,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
COMMON_DIR := $(or $(COMMON_DIR),.)
|
||||
DATA_DIR := $(or $(DATA_DIR),.)
|
||||
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
|
||||
|
||||
CFLAGS := -O3 -Wall -Wpedantic -Wextra
|
||||
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) $(shell pkg-config --cflags lv2) -fPIC $(CFLAGS) $(CFLAGS_EXTRA)
|
||||
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) $(shell pkg-config --cflags lv2) -fPIC $(CFLAGS_EXTRA) $(CFLAGS)
|
||||
|
||||
LDFLAGS :=
|
||||
LDFLAGS_ALL := -shared $(shell pkg-config --libs lv2) $(LDFLAGS) $(LDFLAGS_EXTRA)
|
||||
LDFLAGS_ALL := -shared $(shell pkg-config --libs lv2) $(LDFLAGS_EXTRA) $(LDFLAGS)
|
||||
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -fPIC $(CXXFLAGS) $(CXXFLAGS_EXTRA)
|
||||
CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -fPIC $(CXXFLAGS_EXTRA) $(CXXFLAGS)
|
||||
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
CFLAGS_ALL := $(CFLAGS_ALL) -arch arm64 -arch x86_64
|
||||
@ -78,7 +83,7 @@ CXX_OBJS := $(addprefix build/obj/, $(notdir $(CXX_SRCS:.cpp=.o)))
|
||||
|
||||
ALL := build/$(BUNDLE_DIR)/manifest.ttl build/$(BUNDLE_DIR)/$(DLL_FILE)
|
||||
|
||||
-include $(COMMON_DIR)/vars-extra.mk
|
||||
-include $(MKINC_DIR)/vars-extra.mk
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
@ -127,7 +132,7 @@ install-user: all
|
||||
install -m $$m $$f "$(LV2DIR_USER)/$$d"; \
|
||||
done
|
||||
|
||||
-include $(COMMON_DIR)/rules-extra.mk
|
||||
-include $(MKINC_DIR)/rules-extra.mk
|
||||
|
||||
.PHONY: all clean install install-user
|
||||
|
||||
@ -141,4 +146,4 @@ $(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$
|
||||
$(CXX_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).cpp,$$(CXX_SRCS)) | build/obj
|
||||
$(CXX) $^ -o $@ -c $(CXXFLAGS_ALL)
|
||||
|
||||
-include $(COMMON_DIR)/rules-secondexp-extra.mk
|
||||
-include $(MKINC_DIR)/rules-secondexp-extra.mk
|
||||
|
@ -20,13 +20,15 @@
|
||||
|
||||
BUNDLE_NAME := {{=it.product.bundleName}}
|
||||
|
||||
CFLAGS_EXTRA := {{=it.make?.cflags ?? ""}} {{=it.lv2_make?.cflags ?? ""}}
|
||||
CXXFLAGS_EXTRA := {{=it.make?.cxxflags ?? ""}} {{=it.lv2_make?.cxxflags ?? ""}}
|
||||
LDFLAGS_EXTRA := {{=it.make?.ldflags ?? ""}} {{=it.lv2_make?.ldflags ?? ""}}
|
||||
|
||||
C_SRCS_EXTRA := {{=it.make?.cSrcs ?? ""}} {{=it.lv2_make?.cSrcs ?? ""}}
|
||||
CXX_SRCS_EXTRA := {{=it.make?.cxxSrcs ?? ""}} {{=it.lv2_make?.cxxSrcs ?? ""}}
|
||||
|
||||
{{?(it.lv2_make?.commonDir || it.make?.commonDir)}}
|
||||
COMMON_DIR := {{=it.lv2_make?.commonDir ?? (it.make?.commonDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.lv2_make?.dataDir || it.make?.dataDir)}}
|
||||
DATA_DIR := {{=it.lv2_make?.dataDir ?? (it.make?.dataDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.lv2_make?.pluginDir || it.make?.pluginDir)}}
|
||||
PLUGIN_DIR := {{=it.lv2_make?.pluginDir ?? (it.make?.pluginDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.lv2_make?.mkincDir || it.make?.mkincDir)}}
|
||||
MKINC_DIR := {{=it.lv2_make?.mkincDir ?? (it.make?.mkincDir ?? "")}}
|
||||
{{?}}
|
||||
|
@ -18,8 +18,17 @@
|
||||
# File author: Stefano D'Angelo
|
||||
#
|
||||
|
||||
TEMPLATE := vst3
|
||||
|
||||
include vars.mk
|
||||
|
||||
COMMON_DIR ?= .
|
||||
DATA_DIR ?= .
|
||||
PLUGIN_DIR ?= src
|
||||
MKINC_DIR ?= $(COMMON_DIR)
|
||||
|
||||
-include $(MKINC_DIR)/vars-pre.mk
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
DLL_SUFFIX := .vst3
|
||||
PLATFORM := x86_64-win
|
||||
@ -46,18 +55,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
COMMON_DIR := $(or $(COMMON_DIR),.)
|
||||
DATA_DIR := $(or $(DATA_DIR),.)
|
||||
PLUGIN_DIR := $(or $(PLUGIN_DIR),src)
|
||||
|
||||
CFLAGS := -O3 -Wall -Wpedantic -Wextra
|
||||
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -fPIC $(CFLAGS) $(CFLAGS_EXTRA)
|
||||
CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -fPIC $(CFLAGS_EXTRA) $(CFLAGS)
|
||||
|
||||
LDFLAGS :=
|
||||
LDFLAGS_ALL := -shared -lm $(LDFLAGS) $(LDFLAGS_EXTRA)
|
||||
LDFLAGS_ALL := -shared -lm $(LDFLAGS_EXTRA) $(LDFLAGS)
|
||||
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -fPIC $(CXXFLAGS) $(CXXFLAGS_EXTRA)
|
||||
CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -fPIC $(CXXFLAGS_EXTRA) $(CXXFLAGS)
|
||||
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
CFLAGS_ALL := $(CFLAGS_ALL) -arch arm64 -arch x86_64
|
||||
@ -95,7 +100,7 @@ ifeq ($(UNAME_S), Darwin)
|
||||
ALL := $(ALL) build/$(BUNDLE_DIR)/Contents/Info.plist build/$(BUNDLE_DIR)/Contents/PkgInfo
|
||||
endif
|
||||
|
||||
-include $(COMMON_DIR)/vars-extra.mk
|
||||
-include $(MKINC_DIR)/vars-extra.mk
|
||||
|
||||
all: $(ALL)
|
||||
|
||||
@ -149,7 +154,7 @@ install-user: all
|
||||
install -m $$m $$f "$(VST3DIR_USER)/$$d"; \
|
||||
done
|
||||
|
||||
-include $(COMMON_DIR)/rules-extra.mk
|
||||
-include $(MKINC_DIR)/rules-extra.mk
|
||||
|
||||
.PHONY: all clean install install-user
|
||||
|
||||
@ -163,4 +168,4 @@ $(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$
|
||||
$(CXX_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).cpp,$$(CXX_SRCS)) | build/obj
|
||||
$(CXX) $^ -o $@ -c $(CXXFLAGS_ALL)
|
||||
|
||||
-include $(COMMON_DIR)/rules-secondexp-extra.mk
|
||||
-include $(MKINC_DIR)/rules-secondexp-extra.mk
|
||||
|
@ -20,15 +20,17 @@
|
||||
|
||||
BUNDLE_NAME := {{=it.product.bundleName}}
|
||||
|
||||
CFLAGS_EXTRA := {{=it.make?.cflags ?? ""}} {{=it.vst3_make?.cflags ?? ""}}
|
||||
CXXFLAGS_EXTRA := {{=it.make?.cxxflags ?? ""}} {{=it.vst3_make?.cxxflags ?? ""}}
|
||||
LDFLAGS_EXTRA := {{=it.make?.ldflags ?? ""}} {{=it.vst3_make?.ldflags ?? ""}}
|
||||
|
||||
C_SRCS_EXTRA := {{=it.make?.cSrcs ?? ""}} {{=it.vst3_make?.cSrcs ?? ""}}
|
||||
CXX_SRCS_EXTRA := {{=it.make?.cxxSrcs ?? ""}} {{=it.vst3_make?.cxxSrcs ?? ""}}
|
||||
|
||||
{{?(it.vst3_make?.commonDir || it.make?.commonDir)}}
|
||||
COMMON_DIR := {{=it.vst3_make?.commonDir ?? (it.make?.commonDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.vst3_make?.dataDir || it.make?.dataDir)}}
|
||||
DATA_DIR := {{=it.vst3_make?.dataDir ?? (it.make?.dataDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.vst3_make?.pluginDir || it.make?.pluginDir)}}
|
||||
PLUGIN_DIR := {{=it.vst3_make?.pluginDir ?? (it.make?.pluginDir ?? "")}}
|
||||
{{?}}
|
||||
{{?(it.vst3_make?.mkincDir || it.make?.mkincDir)}}
|
||||
MKINC_DIR := {{=it.vst3_make?.mkincDir ?? (it.make?.mkincDir ?? "")}}
|
||||
{{?}}
|
||||
|
||||
HAS_UI := {{=it.product.ui ? "yes" : "no"}}
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"cmd_make": {
|
||||
"tinywavDir": "../../../tinywav",
|
||||
"midiParserDir": "../../../midi-parser"
|
||||
}
|
||||
}
|
5
test/make.json
Normal file
5
test/make.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"make": {
|
||||
"mkincDir": "../mk"
|
||||
}
|
||||
}
|
10
test/run.sh
10
test/run.sh
@ -1,14 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
dir=`dirname $0`
|
||||
|
||||
mkdir -p $dir/../out/mk
|
||||
cp $dir/vars-pre.mk $dir/../out/mk
|
||||
|
||||
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/vst3
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json $dir/../templates/vst3 $dir/../out/vst3
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json,$dir/vst3-make.json $dir/../templates/vst3-make $dir/../out/vst3
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json,$dir/make.json $dir/../templates/vst3-make $dir/../out/vst3
|
||||
cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/vst3/src
|
||||
|
||||
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/lv2
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json $dir/../templates/lv2 $dir/../out/lv2
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json,$dir/lv2-make.json $dir/../templates/lv2-make $dir/../out/lv2
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json,$dir/make.json $dir/../templates/lv2-make $dir/../out/lv2
|
||||
cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/lv2/src
|
||||
|
||||
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/web
|
||||
@ -30,7 +34,7 @@ cp $dir/plugin.h $dir/../out/ios/src
|
||||
|
||||
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/cmd
|
||||
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/cmd $dir/../out/cmd
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/cmd-make.json $dir/../templates/cmd-make $dir/../out/cmd
|
||||
$dir/../tibia $dir/product.json,$dir/company.json,$dir/make.json $dir/../templates/cmd-make $dir/../out/cmd
|
||||
cp $dir/plugin.h $dir/../out/cmd/src
|
||||
|
||||
$dir/../tibia $dir/product.json,$dir/company.json $dir/../templates/common $dir/../out/daisy-seed
|
||||
|
14
test/vars-pre.mk
Normal file
14
test/vars-pre.mk
Normal file
@ -0,0 +1,14 @@
|
||||
ifeq ($(TEMPLATE), cmd)
|
||||
TINYWAV_DIR := ../../../tinywav
|
||||
MIDI_PARSER_DIR := ../../../midi-parser
|
||||
endif
|
||||
|
||||
ifeq ($(TEMPLATE), lv2)
|
||||
CFLAGS_EXTRA := $(shell pkg-config --cflags pugl-cairo-0 pugl-0 cairo)
|
||||
LDFLAGS_EXTRA := $(shell pkg-config --libs pugl-cairo-0 pugl-0 cairo) -Wl,-rpath,$(shell pkg-config --variable=libdir pugl-cairo-0),-rpath,$(shell pkg-config --variable=libdir pugl-0),-rpath,$(shell pkg-config --variable=libdir cairo)
|
||||
endif
|
||||
|
||||
ifeq ($(TEMPLATE), vst3)
|
||||
CFLAGS_EXTRA := -I../../../vst3_c_api $(shell pkg-config --cflags pugl-cairo-0)
|
||||
LDFLAGS_EXTRA := $(shell pkg-config --libs pugl-cairo-0 pugl-0 cairo) -Wl,-rpath,$(shell pkg-config --variable=libdir pugl-cairo-0),-rpath,$(shell pkg-config --variable=libdir pugl-0),-rpath,$(shell pkg-config --variable=libdir cairo)
|
||||
endif
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"vst3_make": {
|
||||
"cflags": "-I../../../vst3_c_api $(shell pkg-config --cflags pugl-cairo-0)",
|
||||
"ldflags": "$(shell pkg-config --libs pugl-cairo-0 pugl-0 cairo) -Wl,-rpath,$(shell pkg-config --variable=libdir pugl-cairo-0),-rpath,$(shell pkg-config --variable=libdir pugl-0),-rpath,$(shell pkg-config --variable=libdir cairo)"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user