franta-hg@1: # cpp-finally franta-hg@1: # Copyright © 2024 František Kučera (Frantovo.cz, GlobalCode.info) franta-hg@1: # franta-hg@1: # This program is free software: you can redistribute it and/or modify franta-hg@1: # it under the terms of the GNU General Public License as published by franta-hg@1: # the Free Software Foundation, version 3 of the License. franta-hg@1: # franta-hg@1: # This program is distributed in the hope that it will be useful, franta-hg@1: # but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@1: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@1: # GNU General Public License for more details. franta-hg@1: # franta-hg@1: # You should have received a copy of the GNU General Public License franta-hg@1: # along with this program. If not, see . franta-hg@1: franta-hg@0: CXX ?= g++ franta-hg@0: CXXFLAGS ?= -O2 -g3 -ggdb -Wall -Wno-sign-compare franta-hg@0: CXXFLAGS += --std=c++20 franta-hg@0: CXXFLAGS += -fsanitize=undefined -fsanitize=address franta-hg@0: LDFLAGS ?= franta-hg@0: franta-hg@0: SRC = $(shell find -maxdepth 1 -name '*.cpp') franta-hg@0: BIN = $(shell find -maxdepth 1 -name '*.cpp' | xargs basename -s .cpp) franta-hg@0: franta-hg@0: all: $(BIN) franta-hg@0: franta-hg@0: .PHONY: all run clean franta-hg@0: franta-hg@0: clean: franta-hg@0: $(RM) $(BIN) franta-hg@0: franta-hg@0: run: $(BIN) franta-hg@0: @echo "\e[1;32mHappy path without exceptions:\e[0m" franta-hg@2: @for bin in $(BIN); do ./$$bin ; true; done franta-hg@0: @echo; echo franta-hg@0: @echo "\e[1;32mInterrupted by exceptions:\e[0m" franta-hg@2: @for bin in $(BIN); do ./$$bin fail; true; done franta-hg@0: franta-hg@0: $(BIN): $(SRC) franta-hg@0: $(CXX) $(CXXFLAGS) -o $(@) $(@).cpp $(LDFLAGS) franta-hg@0: franta-hg@0: # Blok finally při odchytávání výjimek: C++ vs. Java franta-hg@0: # https://blog.frantovo.cz/c/395/