-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (45 loc) · 1.83 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
NAME = midi-trigger
BUILD_DIR = ./build
BUNDLE = $(BUILD_DIR)/$(NAME).lv2
LIBS = -lm $(shell pkg-config --cflags --libs lv2)
CXX = gcc
CXX_FLAGS = -std=c99 -fPIC -DPIC
ifeq ($(DEBUG),Y)
RELEASE_C_FLAGS = -O0 -g -DDEBUG
else
RELEASE_C_FLAGS = -O
endif
TTLS = manifest.ttl "$(NAME)".ttl
all: $(BUNDLE)
prepare-build:
mkdir --parent -- "$(BUILD_DIR)" "$(BUILD_DIR)"/interface
$(BUNDLE): prepare-build $(BUILD_DIR)/$(NAME).so
mkdir -- "$(BUNDLE)"
cp -- $(TTLS) "$(BUILD_DIR)"/"$(NAME)".so "$(BUNDLE)"
$(BUILD_DIR)/$(NAME).so: prepare-build $(BUILD_DIR)/rms.o $(BUILD_DIR)/uris.o \
$(BUILD_DIR)/interface/instantiate.o $(BUILD_DIR)/interface/connect_port.o \
$(BUILD_DIR)/interface/run.o $(BUILD_DIR)/interface/cleanup.o
mkdir --parent -- "$(BUILD_DIR)"/
$(CXX) $(CXX_FLAGS) -shared \
src/"$(NAME)".c \
"$(BUILD_DIR)"/rms.o \
"$(BUILD_DIR)"/uris.o \
"$(BUILD_DIR)"/interface/instantiate.o \
"$(BUILD_DIR)"/interface/connect_port.o \
"$(BUILD_DIR)"/interface/run.o \
"$(BUILD_DIR)"/interface/cleanup.o \
$(LIBS) -o "$(BUILD_DIR)"/"$(NAME)".so $(RELEASE_C_FLAGS) $(C_FLAGS)
$(BUILD_DIR)/uris.o: prepare-build
$(CXX) $(CXX_FLAGS) src/uris.c -c -o "$(BUILD_DIR)"/uris.o
$(BUILD_DIR)/rms.o: prepare-build
$(CXX) $(CXX_FLAGS) src/rms.c -c -o "$(BUILD_DIR)"/rms.o
$(BUILD_DIR)/interface/instantiate.o: prepare-build
$(CXX) $(CXX_FLAGS) src/interface/instantiate.c -c -o "$(BUILD_DIR)"/interface/instantiate.o
$(BUILD_DIR)/interface/connect_port.o: prepare-build
$(CXX) $(CXX_FLAGS) src/interface/connect_port.c -c -o "$(BUILD_DIR)"/interface/connect_port.o
$(BUILD_DIR)/interface/run.o: prepare-build
$(CXX) $(CXX_FLAGS) src/interface/run.c -c -o "$(BUILD_DIR)"/interface/run.o
$(BUILD_DIR)/interface/cleanup.o: prepare-build
$(CXX) $(CXX_FLAGS) src/interface/cleanup.c -c -o "$(BUILD_DIR)"/interface/cleanup.o
clean:
rm -rf -- "$(BUILD_DIR)"