forked from sevagh/pitch-detection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
44 lines (30 loc) · 1.01 KB
/
GNUmakefile
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
SRCDIR := src
EXAMPLEDIR := example
LIBDIR := lib
BINDIR := bin
INCLUDEDIR := include
INSTALLHDR := /usr/include
INSTALLLIB := /usr/lib
SRCS := $(wildcard $(SRCDIR)/*.cpp)
EXAMPLES := $(wildcard $(EXAMPLEDIR)/*.cpp)
HDRS := $(wildcard $(INCLUDEDIR)/*.h)
CXX_FLAGS := -ansi -pedantic -Werror -Wall -O3 -std=c++17 -fPIC -fext-numeric-literals -ffast-math -flto
BINS := $(EXAMPLES:$(EXAMPLEDIR)/%.cpp=$(BINDIR)/%)
FFT_FLAG ?= -lffts
.PHONY: all
all: build
lint:
@$(foreach file,$(SRCS) $(HDRS),clang-format -i $(file);)
build: directories
$(CXX) -shared -o $(LIBDIR)/libpitch_detection.so $(FFT_FLAG) $(CXX_FLAGS) $(SRCS) -I$(INCLUDEDIR)
directories:
@mkdir -p $(LIBDIR) $(BINDIR)
clean:
-rm -rf $(LIBDIR) $(BINDIR)
install: build
cp $(INCLUDEDIR)/pitch_detection.h $(INSTALLHDR)
cp $(LIBDIR)/libpitch_detection.so $(INSTALLLIB)
examples: build directories $(BINS)
$(BINDIR)/%: $(EXAMPLEDIR)/%.cpp
$(CXX) $< $(LIBDIR)/libpitch_detection.so $(CXX_FLAGS) -o $@ $(FFT_FLAG) -I$(INCLUDEDIR)
.PHONY: libxcorr clean