This is far from real documentation both in structure and contents - it's only a start, from which we can expand.
50 lines
1.2 KiB
Makefile
50 lines
1.2 KiB
Makefile
MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)"
|
|
CXXFLAGS:=$(CXXFLAGS) -std=c++20 -Wall -Wextra -Werror=switch -Werror=unused-result
|
|
CPPFLAGS:=$(CPPFLAGS) -Ilib/expected/ -Ilib/ut/ -Isrc/
|
|
|
|
Obj=bin/errors.o \
|
|
bin/lexer.o \
|
|
bin/location.o \
|
|
bin/parser.o \
|
|
bin/unicode.o \
|
|
bin/unicode_tables.o
|
|
|
|
all: bin/musique bin/unit-tests
|
|
|
|
bin/%.o: src/%.cc src/*.hh
|
|
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $< -c
|
|
|
|
bin/musique: $(Obj) bin/main.o src/*.hh
|
|
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $(Obj) bin/main.o
|
|
|
|
.PHONY: unit-tests
|
|
unit-tests: bin/unit-tests
|
|
./$<
|
|
|
|
.PHONY: unit-test-coverage
|
|
unit-test-coverage:
|
|
@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 )
|
|
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
|
|
xdg-open coverage/index.html
|
|
|
|
.PHONY: doc
|
|
doc: Doxyfile src/*.cc src/*.hh
|
|
doxygen
|
|
cd doc; $(MAKE) html
|
|
|
|
bin/unit-tests: src/tests/*.cc $(Obj)
|
|
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $^
|
|
|
|
clean:
|
|
rm -rf bin coverage
|
|
|
|
.PHONY: clean
|
|
|
|
$(shell mkdir -p bin)
|