author | František Kučera <franta-hg@frantovo.cz> |
Wed, 30 Oct 2024 02:44:44 +0100 | |
changeset 0 | e4f2d6d0e869 |
child 1 | 4502b1c7346d |
permissions | -rw-r--r-- |
franta-hg@0 | 1 |
CXX ?= g++ |
franta-hg@0 | 2 |
CXXFLAGS ?= -O2 -g3 -ggdb -Wall -Wno-sign-compare |
franta-hg@0 | 3 |
CXXFLAGS += --std=c++20 |
franta-hg@0 | 4 |
CXXFLAGS += -fsanitize=undefined -fsanitize=address |
franta-hg@0 | 5 |
LDFLAGS ?= |
franta-hg@0 | 6 |
|
franta-hg@0 | 7 |
SRC = $(shell find -maxdepth 1 -name '*.cpp') |
franta-hg@0 | 8 |
BIN = $(shell find -maxdepth 1 -name '*.cpp' | xargs basename -s .cpp) |
franta-hg@0 | 9 |
|
franta-hg@0 | 10 |
all: $(BIN) |
franta-hg@0 | 11 |
|
franta-hg@0 | 12 |
.PHONY: all run clean |
franta-hg@0 | 13 |
|
franta-hg@0 | 14 |
clean: |
franta-hg@0 | 15 |
$(RM) $(BIN) |
franta-hg@0 | 16 |
|
franta-hg@0 | 17 |
run: $(BIN) |
franta-hg@0 | 18 |
@echo "\e[1;32mHappy path without exceptions:\e[0m" |
franta-hg@0 | 19 |
@for bin in $(BIN); do ./$$bin ; done |
franta-hg@0 | 20 |
@echo; echo |
franta-hg@0 | 21 |
@echo "\e[1;32mInterrupted by exceptions:\e[0m" |
franta-hg@0 | 22 |
@for bin in $(BIN); do ./$$bin fail; done |
franta-hg@0 | 23 |
|
franta-hg@0 | 24 |
$(BIN): $(SRC) |
franta-hg@0 | 25 |
$(CXX) $(CXXFLAGS) -o $(@) $(@).cpp $(LDFLAGS) |
franta-hg@0 | 26 |
|
franta-hg@0 | 27 |
# Blok finally při odchytávání výjimek: C++ vs. Java |
franta-hg@0 | 28 |
# https://blog.frantovo.cz/c/395/ |