forked from sfztools/sfizz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dpf.mk
95 lines (76 loc) · 2.4 KB
/
dpf.mk
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#
# A build file to help using sfizz with the DISTRHO Plugin Framework (DPF)
# ------------------------------------------------------------------------
#
# Usage notes:
#
# 1. Start with the template DPF project
#
# (for example https://github.com/SpotlightKid/cookiecutter-dpf-effect)
#
# 2. In the top directory of the DPF project, edit `Makefile`
#
# Add the following line, after the `all` rule definition:
#
# include <path-to-sfizz>/dpf.mk
#
# Add `sfizz-lib` to the `libs` rule definition:
#
# libs: sfizz-lib
#
# If you want you can add `sfizz-clean` to the `clean` rule.
#
# clean: sfizz-clean
#
# 3. In the Makefile of your plugin folder, eg. `plugins/MyPlugin/Makefile`
#
# Add the following line, after `include ../../dpf/Makefile.plugins.mk`
#
# include <path-to-sfizz>/dpf.mk
# BUILD_C_FLAGS += $(SFIZZ_C_FLAGS)
# BUILD_CXX_FLAGS += $(SFIZZ_CXX_FLAGS)
# LINK_FLAGS += $(SFIZZ_LINK_FLAGS)
#
# 4. Build using `make` from the top folder.
#
SFIZZ_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
SFIZZ_BUILD_DIR := $(SFIZZ_DIR)/dpf-build
SFIZZ_LINK_FLAGS = $(SFIZZ_BUILD_DIR)/libsfizz.a
SFIZZ_PKG_CONFIG ?= $(PKG_CONFIG)
include $(SFIZZ_DIR)/common.mk
sfizz-all: sfizz-lib
sfizz-lib: $(SFIZZ_BUILD_DIR)/libsfizz.a
sfizz-clean:
rm -rf $(SFIZZ_BUILD_DIR)
.PHONY: sfizz-all sfizz-lib sfizz-clean
###
SFIZZ_OBJECTS = $(SFIZZ_SOURCES:%=$(SFIZZ_BUILD_DIR)/%.o)
$(SFIZZ_BUILD_DIR)/libsfizz.a: $(SFIZZ_OBJECTS)
-@mkdir -p $(dir $@)
@echo "Creating $@"
$(SILENT)$(AR) crs $@ $^
###
ifeq ($(CPU_I386_OR_X86_64),true)
$(SFIZZ_BUILD_DIR)/%SSE.cpp.o: $(SFIZZ_DIR)/%SSE.cpp
-@mkdir -p $(dir $@)
@echo "Compiling $<"
$(SILENT)$(CXX) $(BUILD_CXX_FLAGS) $(SFIZZ_CXX_FLAGS) -msse -c -o $@ $<
$(SFIZZ_BUILD_DIR)/%AVX.cpp.o: $(SFIZZ_DIR)/%AVX.cpp
-@mkdir -p $(dir $@)
@echo "Compiling $<"
$(SILENT)$(CXX) $(BUILD_CXX_FLAGS) $(SFIZZ_CXX_FLAGS) -mavx -c -o $@ $<
endif
###
$(SFIZZ_BUILD_DIR)/%.cpp.o: $(SFIZZ_DIR)/%.cpp
-@mkdir -p $(dir $@)
@echo "Compiling $<"
$(SILENT)$(CXX) $(BUILD_CXX_FLAGS) $(SFIZZ_CXX_FLAGS) -c -o $@ $<
$(SFIZZ_BUILD_DIR)/%.cc.o: $(SFIZZ_DIR)/%.cc
-@mkdir -p $(dir $@)
@echo "Compiling $<"
$(SILENT)$(CXX) $(BUILD_CXX_FLAGS) $(SFIZZ_CXX_FLAGS) -c -o $@ $<
$(SFIZZ_BUILD_DIR)/%.c.o: $(SFIZZ_DIR)/%.c
-@mkdir -p $(dir $@)
@echo "Compiling $<"
$(SILENT)$(CC) $(BUILD_C_FLAGS) $(SFIZZ_C_FLAGS) -c -o $@ $<
-include $(SFIZZ_OBJECTS:%.o=%.d)