-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
28 lines (23 loc) · 904 Bytes
/
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
CXX := g++
#CXXFLAGS := -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-parameter -O0 -DKIT_DEBUG -g
CXXFLAGS := -std=c++14 -Wall -Wextra -Wpedantic -Wno-unused-parameter -O2 -g
#LDFLAGS := -ldl -pthread
REQLIBS := kit
LIBS := $(shell pkg-config --libs $(REQLIBS))
DEPFLAGS := $(shell pkg-config --cflags $(REQLIBS))
OUT_BINARY := demo
BUILDDIR := build
SOURCEDIR := src
INCLUDEDIR := include
SOURCES := $(shell find $(SOURCEDIR) -name '*.cpp')
OBJECTS := $(addprefix $(BUILDDIR)/,$(SOURCES:%.cpp=%.o))
$(OUT_BINARY): $(OBJECTS)
$(shell mkdir bin)
$(CXX) $(CXXFLAGS) $(DEPFLAGS) $(LDFLAGS) $(LIBS) $(OBJECTS) -o dist/$(OUT_BINARY)
$(BUILDDIR)/%.o: %.cpp
@echo 'Building ${notdir $@} ...'
$(shell mkdir -p "${dir $@}")
$(CXX) $(CXXFLAGS) $(DEPFLAGS) -I$(INCLUDEDIR) -c $< -o $@
clean:
$(shell rm -rf ./build)
$(shell rm -rf ./bin)