2022-04-24 15:27:09 +02:00
|
|
|
MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)"
|
2022-05-16 02:18:53 +02:00
|
|
|
CXXFLAGS:=$(CXXFLAGS) -std=c++20 -Wall -Wextra -Werror=switch -Werror=return-type -Werror=unused-result
|
2022-05-23 17:27:06 +02:00
|
|
|
CPPFLAGS:=$(CPPFLAGS) -Ilib/expected/ -Ilib/ut/ -Ilib/midi/include -Isrc/
|
2022-05-21 23:11:04 +02:00
|
|
|
RELEASE_FLAGS=-O3
|
|
|
|
DEBUG_FLAGS=-O0 -ggdb
|
2022-05-25 03:14:29 +02:00
|
|
|
CXX=g++
|
2022-04-24 15:27:09 +02:00
|
|
|
|
2022-05-23 17:27:06 +02:00
|
|
|
LDFLAGS=-L./lib/midi/
|
|
|
|
LDLIBS=-lmidi-alsa -lasound
|
|
|
|
|
2022-05-21 23:11:04 +02:00
|
|
|
Obj= \
|
2022-05-24 02:58:15 +02:00
|
|
|
context.o \
|
2022-05-21 23:11:04 +02:00
|
|
|
environment.o \
|
|
|
|
errors.o \
|
|
|
|
interpreter.o \
|
|
|
|
lexer.o \
|
|
|
|
location.o \
|
|
|
|
number.o \
|
|
|
|
parser.o \
|
|
|
|
unicode.o \
|
|
|
|
unicode_tables.o \
|
|
|
|
value.o
|
|
|
|
|
2022-05-24 03:00:51 +02:00
|
|
|
Tests= \
|
|
|
|
context.o \
|
|
|
|
environment.o \
|
|
|
|
interpreter.o \
|
|
|
|
lex.o \
|
|
|
|
main.o \
|
|
|
|
number.o \
|
|
|
|
parser.o \
|
|
|
|
unicode.o \
|
|
|
|
value.o
|
|
|
|
|
2022-05-21 23:11:04 +02:00
|
|
|
Release_Obj=$(addprefix bin/,$(Obj))
|
|
|
|
Debug_Obj=$(addprefix bin/debug/,$(Obj))
|
2022-05-24 03:00:51 +02:00
|
|
|
Test_Obj=$(addprefix bin/debug/tests/,$(Tests))
|
2022-04-24 16:09:55 +02:00
|
|
|
|
2022-05-21 23:54:21 +02:00
|
|
|
all: bin/musique
|
2022-04-24 15:27:09 +02:00
|
|
|
|
2022-05-22 06:33:17 +02:00
|
|
|
test: unit-tests
|
|
|
|
etc/tools/test.py test examples
|
|
|
|
|
2022-05-21 23:11:04 +02:00
|
|
|
debug: bin/debug/musique
|
|
|
|
|
2022-04-24 15:27:09 +02:00
|
|
|
bin/%.o: src/%.cc src/*.hh
|
2022-05-25 03:14:29 +02:00
|
|
|
@echo "CXX $@"
|
|
|
|
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $< -c
|
2022-05-21 23:11:04 +02:00
|
|
|
|
2022-05-23 17:27:06 +02:00
|
|
|
bin/musique: $(Release_Obj) bin/main.o src/*.hh lib/midi/libmidi-alsa.a
|
2022-05-25 03:14:29 +02:00
|
|
|
@echo "CXX $@"
|
|
|
|
@$(CXX) $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $(Release_Obj) bin/main.o $(LDFLAGS) $(LDLIBS)
|
2022-05-21 23:11:04 +02:00
|
|
|
|
|
|
|
bin/debug/musique: $(Debug_Obj) bin/debug/main.o src/*.hh
|
2022-05-25 03:14:29 +02:00
|
|
|
@echo "CXX $@"
|
2022-05-25 04:30:24 +02:00
|
|
|
@$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $(Debug_Obj) bin/debug/main.o $(LDFLAGS) $(LDLIBS)
|
2022-04-24 15:27:09 +02:00
|
|
|
|
2022-05-21 23:11:04 +02:00
|
|
|
bin/debug/%.o: src/%.cc src/*.hh
|
2022-05-25 03:14:29 +02:00
|
|
|
@echo "CXX $@"
|
|
|
|
@$(CXX) $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $< -c
|
2022-04-24 16:09:55 +02:00
|
|
|
|
|
|
|
unit-tests: bin/unit-tests
|
|
|
|
./$<
|
|
|
|
|
2022-05-02 22:09:11 +02:00
|
|
|
unit-test-coverage:
|
2022-05-02 22:24:01 +02:00
|
|
|
@which gcov >/dev/null || ( echo "[ERROR] gcov is required for test coverage report"; false )
|
|
|
|
@which gcovr >/dev/null || ( echo "[ERROR] gcovr is required for test coverage report"; false )
|
2022-05-02 22:09:11 +02:00
|
|
|
CXXFLAGS=--coverage $(MAKE) bin/unit-tests -B
|
|
|
|
bin/unit-tests
|
|
|
|
rm -rf coverage
|
|
|
|
mkdir coverage
|
|
|
|
gcovr -e '.*\.hpp' --html --html-details -o coverage/index.html
|
2022-05-22 04:31:31 +02:00
|
|
|
rm -rf bin/debug
|
2022-05-08 18:02:23 +02:00
|
|
|
xdg-open coverage/index.html
|
|
|
|
|
|
|
|
doc: Doxyfile src/*.cc src/*.hh
|
|
|
|
doxygen
|
|
|
|
cd doc; $(MAKE) html
|
2022-05-02 22:09:11 +02:00
|
|
|
|
2022-05-10 15:25:17 +02:00
|
|
|
doc-open: doc
|
|
|
|
xdg-open ./doc/build/html/index.html
|
|
|
|
|
2022-05-24 03:00:51 +02:00
|
|
|
bin/unit-tests: $(Test_Obj) $(Debug_Obj)
|
2022-05-25 03:14:29 +02:00
|
|
|
@echo "CXX $@"
|
|
|
|
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(DEBUG_FLAGS) -o $@ $^
|
2022-04-24 15:27:09 +02:00
|
|
|
|
|
|
|
clean:
|
2022-05-02 22:12:29 +02:00
|
|
|
rm -rf bin coverage
|
2022-04-24 15:27:09 +02:00
|
|
|
|
2022-05-22 06:33:17 +02:00
|
|
|
.PHONY: clean doc doc-open all test unit-tests
|
2022-04-24 15:27:09 +02:00
|
|
|
|
2022-05-24 03:00:51 +02:00
|
|
|
$(shell mkdir -p bin/debug/tests)
|