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-02 22:09:11 +02:00
|
|
|
CPPFLAGS:=$(CPPFLAGS) -Ilib/expected/ -Ilib/ut/ -Isrc/
|
2022-04-24 15:27:09 +02:00
|
|
|
|
2022-05-16 02:18:53 +02:00
|
|
|
Obj= \
|
|
|
|
bin/errors.o \
|
|
|
|
bin/interpreter.o \
|
|
|
|
bin/lexer.o \
|
|
|
|
bin/location.o \
|
|
|
|
bin/number.o \
|
|
|
|
bin/parser.o \
|
|
|
|
bin/unicode.o \
|
|
|
|
bin/unicode_tables.o \
|
|
|
|
bin/value.o
|
2022-04-24 16:09:55 +02:00
|
|
|
|
|
|
|
all: bin/musique bin/unit-tests
|
2022-04-24 15:27:09 +02:00
|
|
|
|
|
|
|
bin/%.o: src/%.cc src/*.hh
|
|
|
|
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $< -c
|
|
|
|
|
2022-04-24 16:09:55 +02:00
|
|
|
bin/musique: $(Obj) bin/main.o src/*.hh
|
|
|
|
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $(Obj) bin/main.o
|
|
|
|
|
|
|
|
.PHONY: unit-tests
|
|
|
|
unit-tests: bin/unit-tests
|
|
|
|
./$<
|
|
|
|
|
2022-05-08 18:02:23 +02:00
|
|
|
.PHONY: unit-test-coverage
|
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
|
|
|
|
rm -rf bin
|
2022-05-08 18:02:23 +02:00
|
|
|
xdg-open coverage/index.html
|
|
|
|
|
|
|
|
.PHONY: doc
|
|
|
|
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
|
|
|
.PHONY: doc-open
|
|
|
|
doc-open: doc
|
|
|
|
xdg-open ./doc/build/html/index.html
|
|
|
|
|
2022-04-24 16:09:55 +02:00
|
|
|
bin/unit-tests: src/tests/*.cc $(Obj)
|
|
|
|
g++ $(CXXFLAGS) $(CPPFLAGS) -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
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
$(shell mkdir -p bin)
|