Introduced debug builds

This commit is contained in:
Robert Bendun 2022-05-21 23:11:04 +02:00
parent c488153805
commit c51722a607
2 changed files with 32 additions and 18 deletions

View File

@ -1,26 +1,39 @@
MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)" MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)"
CXXFLAGS:=$(CXXFLAGS) -std=c++20 -Wall -Wextra -Werror=switch -Werror=return-type -Werror=unused-result CXXFLAGS:=$(CXXFLAGS) -std=c++20 -Wall -Wextra -Werror=switch -Werror=return-type -Werror=unused-result
CPPFLAGS:=$(CPPFLAGS) -Ilib/expected/ -Ilib/ut/ -Isrc/ CPPFLAGS:=$(CPPFLAGS) -Ilib/expected/ -Ilib/ut/ -Isrc/
RELEASE_FLAGS=-O3
DEBUG_FLAGS=-O0 -ggdb
Obj= \ Obj= \
bin/environment.o \ environment.o \
bin/errors.o \ errors.o \
bin/interpreter.o \ interpreter.o \
bin/lexer.o \ lexer.o \
bin/location.o \ location.o \
bin/number.o \ number.o \
bin/parser.o \ parser.o \
bin/unicode.o \ unicode.o \
bin/unicode_tables.o \ unicode_tables.o \
bin/value.o value.o
Release_Obj=$(addprefix bin/,$(Obj))
Debug_Obj=$(addprefix bin/debug/,$(Obj))
all: bin/musique bin/unit-tests all: bin/musique bin/unit-tests
bin/%.o: src/%.cc src/*.hh debug: bin/debug/musique
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $< -c
bin/musique: $(Obj) bin/main.o src/*.hh bin/%.o: src/%.cc src/*.hh
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $(Obj) bin/main.o g++ $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $< -c
bin/musique: $(Release_Obj) bin/main.o src/*.hh
g++ $(CXXFLAGS) $(RELEASE_FLAGS) $(CPPFLAGS) -o $@ $(Release_Obj) bin/main.o
bin/debug/musique: $(Debug_Obj) bin/debug/main.o src/*.hh
g++ $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $(Debug_Obj) bin/debug/main.o
bin/debug/%.o: src/%.cc src/*.hh
g++ $(CXXFLAGS) $(DEBUG_FLAGS) $(CPPFLAGS) -o $@ $< -c
.PHONY: unit-tests .PHONY: unit-tests
unit-tests: bin/unit-tests unit-tests: bin/unit-tests
@ -47,7 +60,7 @@ doc: Doxyfile src/*.cc src/*.hh
doc-open: doc doc-open: doc
xdg-open ./doc/build/html/index.html xdg-open ./doc/build/html/index.html
bin/unit-tests: src/tests/*.cc $(Obj) bin/unit-tests: src/tests/*.cc $(Release_Obj)
g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ g++ $(CXXFLAGS) $(CPPFLAGS) -o $@ $^
clean: clean:
@ -55,4 +68,4 @@ clean:
.PHONY: clean .PHONY: clean
$(shell mkdir -p bin) $(shell mkdir -p bin/debug)

View File

@ -7,7 +7,8 @@ Interpreter języka Musique. Możliwy do wykorzystywania jako:
## Dostępne komendy ## Dostępne komendy
- `make` - Buduje interpreter `bin/musique` - `make` - Buduje interpreter `bin/musique` (tryb release)
- `make debug` - Buduje interpreter `bin/debug/musique` (tryb debug)
- `make clean` - Usuwa reprodukowalne elementy projektu (automatycznie stworzone pliki binarne czy raporty) - `make clean` - Usuwa reprodukowalne elementy projektu (automatycznie stworzone pliki binarne czy raporty)
### Dokumentacja ### Dokumentacja