organize files into subdirectories (ugly makefile)
This commit is contained in:
parent
defbde30c3
commit
65300c501c
19 changed files with 65 additions and 63 deletions
89
Makefile
89
Makefile
|
@ -5,33 +5,44 @@ DISTNAME = crap
|
||||||
VERSION = git
|
VERSION = git
|
||||||
FULLNAME = ${DISTNAME}-${VERSION}
|
FULLNAME = ${DISTNAME}-${VERSION}
|
||||||
|
|
||||||
BOTH = crap_eq crap_eq_const crap_noise crap_tube
|
BIN=./bin
|
||||||
|
CRAP=./crap
|
||||||
|
INCLUDE=./include
|
||||||
|
TEMPLATE=./template
|
||||||
|
UTIL=./util
|
||||||
|
|
||||||
|
BOTH = eq eq_const noise tube
|
||||||
LADSPA_ONLY =
|
LADSPA_ONLY =
|
||||||
VST_ONLY = crap_delay_test
|
VST_ONLY = delay_test
|
||||||
LADSPA = ${BOTH:=-ladspa} ${LADSPA_ONLY:=-ladspa}
|
LADSPA = ${BOTH:=-ladspa} ${LADSPA_ONLY:=-ladspa}
|
||||||
VST = ${BOTH:=-vst} ${VST_ONLY:=-vst}
|
VST = ${BOTH:=-vst} ${VST_ONLY:=-vst}
|
||||||
PLUGINS = ${LADSPA} ${VST}
|
PLUGINS = ${LADSPA} ${VST}
|
||||||
|
|
||||||
EXE = design
|
EXE = design
|
||||||
HEADERS = crap_util.h crap_util_def.h param.h
|
_ = util util_def param
|
||||||
SHOBJ = ${PLUGINS:=.so}
|
HEADERS = ${_:%=$(INCLUDE)/%.h}
|
||||||
OBJ = ${PLUGINS:=.o} vstsdk.o
|
SHOBJ = ${PLUGINS:%=$(BIN)/$(DISTNAME)_%.so}
|
||||||
|
OBJ = ${PLUGINS:%=$(BIN)/$(DISTNAME)_%.o} $(BIN)/vstsdk.o
|
||||||
|
|
||||||
# only for dist target right now
|
# only for dist target right now
|
||||||
SRC = ${BOTH:=.h} ${LADSPA_ONLY:=.h} ${VST_ONLY:=.h} ${EXE:=.c}
|
SRC = ${BOTH:%=$(CRAP)/%.h}
|
||||||
|
SRC += ${LADSPA_ONLY:%=$(CRAP)/%.h} ${VST_ONLY:%=$(CRAP)/%.h}
|
||||||
|
SRC += ${EXE:%=$(UTIL)/%.c}
|
||||||
|
|
||||||
BENCH = bench.o
|
BENCH = bench.o
|
||||||
AGAINST = ./crap_eq_const-ladspa.so
|
AGAINST = ./crap_eq_const-ladspa.so
|
||||||
|
|
||||||
VST_SDK_DIR ?= .
|
VST_SDK_DIR ?= .
|
||||||
VST_CPP = audioeffect.cpp audioeffectx.cpp vstplugmain.cpp
|
VST_CPP = audioeffect.cpp audioeffectx.cpp vstplugmain.cpp
|
||||||
VST_SRC = ${VST_CPP:%=${VST_SDK_DIR}/public.sdk/source/vst2.x/%}
|
VST_SUB_DIR = public.sdk/source/vst2.x
|
||||||
|
VST_SRC = ${VST_CPP:%=${VST_SDK_DIR}/${VST_SUB_DIR}/%}
|
||||||
# temp objects before combining to vstsdk.o
|
# temp objects before combining to vstsdk.o
|
||||||
VST_OBJ = ${VST_CPP:.cpp=.o}
|
VST_OBJ = ${VST_CPP:%.cpp=$(BIN)/%.o}
|
||||||
VST_DEF = ${VST_SDK_DIR}/public.sdk/samples/vst2.x/win/vstplug.def
|
VST_DEF = ${VST_SDK_DIR}/public.sdk/samples/vst2.x/win/vstplug.def
|
||||||
|
|
||||||
ALL_CFLAGS = -Wall -Wno-unused-function ${CFLAGS} -std=gnu99
|
ALL_CFLAGS = -Wall -Wno-unused-function ${CFLAGS} -std=gnu99 -I $(INCLUDE)
|
||||||
ALL_CXXFLAGS = -Wno-write-strings ${CXXFLAGS} -I ${VST_SDK_DIR} -DBUILDING_DLL=1
|
ALL_CXXFLAGS = -Wno-write-strings ${CXXFLAGS} -I ${VST_SDK_DIR}
|
||||||
|
ALL_CXXFLAGS += -I $(INCLUDE) -DBUILDING_DLL=1
|
||||||
ALL_LDFLAGS = -lm ${LDFLAGS}
|
ALL_LDFLAGS = -lm ${LDFLAGS}
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
@ -41,14 +52,14 @@ LADSPADIR ?= ${LIBDIR}/ladspa
|
||||||
|
|
||||||
LADSPADEST = ${DESTDIR}${LADSPADIR}
|
LADSPADEST = ${DESTDIR}${LADSPADIR}
|
||||||
|
|
||||||
ALL = ${SHOBJ} ${OBJ} ${EXE}
|
ALL = ${SHOBJ} ${OBJ} ${EXE:%=$(BIN)/%}
|
||||||
MISC_CLEAN = bench ${BENCH} ${VST_OBJ}
|
MISC_CLEAN = bench ${BENCH} ${VST_OBJ}
|
||||||
MISC_DIST = LICENSE README.md Makefile
|
MISC_DIST = LICENSE README.md Makefile
|
||||||
MISC_DIST += benchtime ${BENCH:.o=.c}
|
MISC_DIST += $(UTIL)/benchtime $(UTIL)/${BENCH:.o=.c}
|
||||||
MISC_DIST += generate-ladspa generate-vst
|
MISC_DIST += $(UTIL)/generate
|
||||||
MISC_DIST += template-vst.cpp template-ladspa.c ladspa.h
|
MISC_DIST += $(TEMPLATE)/vst.cpp $(TEMPLATE)/ladspa.c $(INCLUDE)/ladspa.h
|
||||||
|
|
||||||
all: options ladspa vst ${EXE}
|
all: ladspa vst ${EXE:%=$(BIN)/%}
|
||||||
|
|
||||||
.PHONY: options
|
.PHONY: options
|
||||||
options:
|
options:
|
||||||
|
@ -61,61 +72,63 @@ options:
|
||||||
@echo "LD = ${LD}"
|
@echo "LD = ${LD}"
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
ladspa: ${LADSPA:=.so}
|
ladspa: ${LADSPA:%=$(BIN)/$(DISTNAME)_%.so}
|
||||||
|
|
||||||
vst: ${VST:=.so}
|
vst: ${VST:%=$(BIN)/$(DISTNAME)_%.so}
|
||||||
|
|
||||||
bench: ${AGAINST} ${BENCH}
|
$(BIN)/bench: ${BENCH}
|
||||||
@echo ' CC '$@
|
@echo ' CC '$@
|
||||||
@${CC} ${ALL_CFLAGS} ${BENCH} -o $@ ${ALL_LDFLAGS} -rdynamic -ldl
|
@${CC} ${ALL_CFLAGS} ${BENCH} -o $@ ${ALL_LDFLAGS} -rdynamic -ldl
|
||||||
|
|
||||||
.PHONY: benchmark
|
.PHONY: benchmark
|
||||||
benchmark: bench
|
benchmark: $(BIN)/bench ${AGAINST}
|
||||||
./benchtime ./bench ${AGAINST}
|
./benchtime ./bench ${AGAINST}
|
||||||
|
|
||||||
vstsdk.o: ${VST_SRC}
|
$(VST_OBJ): ${VST_SRC}
|
||||||
@echo ' CXX '$@
|
@echo ' CXX '$@
|
||||||
@${CXX} -c ${ALL_CXXFLAGS} ${CPPFLAGS} $^
|
@${CXX} -c ${ALL_CXXFLAGS} ${CPPFLAGS} ${VST_SDK_DIR}/${VST_SUB_DIR}/$(notdir ${@:.o=.cpp}) -o $@
|
||||||
|
|
||||||
|
$(BIN)/vstsdk.o: ${VST_OBJ}
|
||||||
@echo ' LD '$@
|
@echo ' LD '$@
|
||||||
@${LD} -r ${VST_OBJ} -o $@
|
@${LD} -r ${VST_OBJ} -o $@
|
||||||
rm ${VST_OBJ}
|
|
||||||
|
|
||||||
%-ladspa.so: %-ladspa.o
|
$(BIN)/%-ladspa.so: $(BIN)/%-ladspa.o
|
||||||
@echo ' CC '$@
|
@echo ' LD '$@
|
||||||
@${CC} ${ALL_CFLAGS} -shared $^ -o $@ ${ALL_LDFLAGS}
|
@${CC} ${ALL_CFLAGS} -shared $^ -o $@ ${ALL_LDFLAGS}
|
||||||
|
|
||||||
%-vst.so: %-vst.o vstsdk.o
|
$(BIN)/%-vst.so: $(BIN)/%-vst.o $(BIN)/vstsdk.o
|
||||||
@echo ' CXX '$@
|
@echo ' LD '$@
|
||||||
@${CXX} ${ALL_CXXFLAGS} -shared $^ -o $@ ${ALL_LDFLAGS}
|
@${CXX} ${ALL_CXXFLAGS} -shared $^ -o $@ ${ALL_LDFLAGS}
|
||||||
|
|
||||||
%-ladspa.o: %-ladspa.c ${HEADERS} ladspa.h
|
$(BIN)/$(DISTNAME)_%-ladspa.o: $(CRAP)/%-ladspa.c ${HEADERS} $(INCLUDE)/ladspa.h
|
||||||
@echo ' CC '$@
|
@echo ' CC '$@
|
||||||
@${CC} -c ${ALL_CFLAGS} ${CPPFLAGS} $< -o $@
|
@${CC} -c ${ALL_CFLAGS} ${CPPFLAGS} $< -o $@
|
||||||
|
|
||||||
%-vst.o: %-vst.cpp ${HEADERS}
|
$(BIN)/$(DISTNAME)_%-vst.o: $(CRAP)/%-vst.cpp ${HEADERS}
|
||||||
@echo ' CXX '$@
|
@echo ' CXX '$@
|
||||||
@${CXX} -c ${ALL_CXXFLAGS} ${CPPFLAGS} $< -o $@
|
@${CXX} -c ${ALL_CXXFLAGS} ${CPPFLAGS} $< -o $@
|
||||||
|
|
||||||
%-ladspa.c: %.h template-ladspa.c generate-ladspa
|
$(CRAP)/%-ladspa.c: $(CRAP)/%.h $(TEMPLATE)/ladspa.c $(UTIL)/generate
|
||||||
./generate-ladspa $< $@
|
@echo ' gen '$@
|
||||||
|
@$(UTIL)/generate $(notdir $<) $@ $(TEMPLATE)/ladspa.c
|
||||||
|
|
||||||
%-vst.cpp: %.h template-vst.cpp generate-vst
|
$(CRAP)/%-vst.cpp: $(CRAP)/%.h $(TEMPLATE)/vst.cpp $(UTIL)/generate
|
||||||
./generate-vst $< $@
|
@$(UTIL)/generate $(notdir $<) $@ $(TEMPLATE)/vst.cpp
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
%: %.o
|
$(BIN)/%: $(BIN)/%.o
|
||||||
@echo ' CC '$@
|
@echo ' CC '$@
|
||||||
@${CC} ${ALL_CFLAGS} $< -o $@ ${ALL_LDFLAGS}
|
@${CC} ${ALL_CFLAGS} $< -o $@ ${ALL_LDFLAGS}
|
||||||
|
|
||||||
%.o: %.c
|
$(BIN)/%.o: $(UTIL)/%.c
|
||||||
@echo ' CC '$@
|
@echo ' CC '$@
|
||||||
@${CC} -c ${ALL_CFLAGS} ${CPPFLAGS} $< -o $@
|
@${CC} -c ${ALL_CFLAGS} ${CPPFLAGS} $< -o $@
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p ${LADSPADEST}
|
mkdir -p ${LADSPADEST}
|
||||||
install -d ${LADSPADEST}
|
install -d ${LADSPADEST}
|
||||||
install -m 644 ${LADSPA:=.so} ${LADSPADEST}
|
install -m 644 $(BIN)/${LADSPA:=.so} ${LADSPADEST}
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -123,9 +136,13 @@ clean:
|
||||||
|
|
||||||
.PHONY: dist
|
.PHONY: dist
|
||||||
dist:
|
dist:
|
||||||
|
@echo " dist target is broken for now, sorry"
|
||||||
|
@false
|
||||||
-rm -f ${FULLNAME}.tar.gz
|
-rm -f ${FULLNAME}.tar.gz
|
||||||
mkdir ${FULLNAME}
|
mkdir ${FULLNAME}
|
||||||
cp ${MISC_DIST} ${HEADERS} ${SRC} ${FULLNAME}
|
cp ${MISC_DIST} ${FULLNAME}
|
||||||
|
cp ${HEADERS} ${FULLNAME}
|
||||||
|
cp ${SRC} ${FULLNAME}
|
||||||
tar -cf ${FULLNAME}.tar ${FULLNAME}
|
tar -cf ${FULLNAME}.tar ${FULLNAME}
|
||||||
gzip ${FULLNAME}.tar
|
gzip ${FULLNAME}.tar
|
||||||
rm -r ${FULLNAME}
|
rm -r ${FULLNAME}
|
||||||
|
|
|
@ -55,8 +55,6 @@ remember to export `VST_SDK_DIR` to the path of your `vstsdk2.4/`
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* rename plugins (fix capitalization consistency and such)
|
* rename plugins (fix capitalization consistency and such)
|
||||||
* remove crap\_ prefixes?
|
|
||||||
* move to subdirs?
|
|
||||||
* reduce input/output buffers on biquads (shared)
|
* reduce input/output buffers on biquads (shared)
|
||||||
* ease up on the preprocessor ifs
|
* ease up on the preprocessor ifs
|
||||||
* polish parameter support
|
* polish parameter support
|
||||||
|
|
2
bin/.gitignore
vendored
Normal file
2
bin/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
|
@ -1,5 +1,4 @@
|
||||||
#define BIQUAD_DOUBLE
|
#include "util.h"
|
||||||
#include "crap_util.h"
|
|
||||||
|
|
||||||
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "crap_util.h"
|
#include "util.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
|
||||||
#define BANDS 4
|
#define BANDS 4
|
|
@ -1,6 +1,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "crap_util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define ID 0x0DEFACED
|
#define ID 0x0DEFACED
|
||||||
#define LABEL "crap_eq_const"
|
#define LABEL "crap_eq_const"
|
|
@ -1,4 +1,4 @@
|
||||||
#include "crap_util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define ID 0xEC57A71C
|
#define ID 0xEC57A71C
|
||||||
#define LABEL "crap_noise"
|
#define LABEL "crap_noise"
|
|
@ -1,6 +1,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "crap_util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define ID 0x50F7BA11
|
#define ID 0x50F7BA11
|
||||||
#define LABEL "crap_tube"
|
#define LABEL "crap_tube"
|
15
generate-vst
15
generate-vst
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
set -u
|
|
||||||
|
|
||||||
pp_include="#include \"$1\""
|
|
||||||
out="$2"
|
|
||||||
|
|
||||||
(cat template-vst.cpp | while read -r; do
|
|
||||||
case "$REPLY" in
|
|
||||||
|
|
||||||
'//#INCLUDE') echo "$pp_include" ;;
|
|
||||||
|
|
||||||
*) echo -E "$REPLY" ;;
|
|
||||||
esac
|
|
||||||
done) > "$out"
|
|
|
@ -58,4 +58,4 @@ design(double cw, double sw,
|
||||||
static double
|
static double
|
||||||
biquad_run(biquad *bq, double x);
|
biquad_run(biquad *bq, double x);
|
||||||
|
|
||||||
#include "crap_util_def.h"
|
#include "util_def.h"
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "dlfcn.h"
|
#include "dlfcn.h"
|
||||||
#include "ladspa.h"
|
#include "ladspa.h"
|
||||||
#include "crap_util.h"
|
#include "util.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BLOCK_SIZE=2048
|
BLOCK_SIZE=2048
|
|
@ -3,7 +3,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "crap_util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
usage()
|
usage()
|
|
@ -4,8 +4,9 @@ set -u
|
||||||
|
|
||||||
pp_include="#include \"$1\""
|
pp_include="#include \"$1\""
|
||||||
out="$2"
|
out="$2"
|
||||||
|
template="$3"
|
||||||
|
|
||||||
(cat template-ladspa.c | while read -r; do
|
(cat "$template" | while read -r; do
|
||||||
case "$REPLY" in
|
case "$REPLY" in
|
||||||
|
|
||||||
'//#INCLUDE') echo "$pp_include" ;;
|
'//#INCLUDE') echo "$pp_include" ;;
|
Loading…
Reference in a new issue