Makefile
changeset 0 e4f2d6d0e869
child 1 4502b1c7346d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Wed Oct 30 02:44:44 2024 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +CXX ?= g++
     1.5 +CXXFLAGS ?= -O2 -g3 -ggdb -Wall -Wno-sign-compare
     1.6 +CXXFLAGS += --std=c++20
     1.7 +CXXFLAGS += -fsanitize=undefined -fsanitize=address
     1.8 +LDFLAGS ?=
     1.9 +
    1.10 +SRC = $(shell find -maxdepth 1 -name '*.cpp')
    1.11 +BIN = $(shell find -maxdepth 1 -name '*.cpp' | xargs basename -s .cpp)
    1.12 +
    1.13 +all: $(BIN)
    1.14 +
    1.15 +.PHONY: all run clean
    1.16 +
    1.17 +clean:
    1.18 +	$(RM) $(BIN)
    1.19 +
    1.20 +run: $(BIN)
    1.21 +	@echo "\e[1;32mHappy path without exceptions:\e[0m"
    1.22 +	@for bin in $(BIN); do ./$$bin     ; done
    1.23 +	@echo; echo
    1.24 +	@echo "\e[1;32mInterrupted by exceptions:\e[0m"
    1.25 +	@for bin in $(BIN); do ./$$bin fail; done
    1.26 +
    1.27 +$(BIN): $(SRC)
    1.28 +	$(CXX) $(CXXFLAGS) -o $(@) $(@).cpp $(LDFLAGS)
    1.29 +
    1.30 +# Blok finally při odchytávání výjimek: C++ vs. Java
    1.31 +# https://blog.frantovo.cz/c/395/