Makefile
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--
blok finally v C++
     1 CXX ?= g++
     2 CXXFLAGS ?= -O2 -g3 -ggdb -Wall -Wno-sign-compare
     3 CXXFLAGS += --std=c++20
     4 CXXFLAGS += -fsanitize=undefined -fsanitize=address
     5 LDFLAGS ?=
     6 
     7 SRC = $(shell find -maxdepth 1 -name '*.cpp')
     8 BIN = $(shell find -maxdepth 1 -name '*.cpp' | xargs basename -s .cpp)
     9 
    10 all: $(BIN)
    11 
    12 .PHONY: all run clean
    13 
    14 clean:
    15 	$(RM) $(BIN)
    16 
    17 run: $(BIN)
    18 	@echo "\e[1;32mHappy path without exceptions:\e[0m"
    19 	@for bin in $(BIN); do ./$$bin     ; done
    20 	@echo; echo
    21 	@echo "\e[1;32mInterrupted by exceptions:\e[0m"
    22 	@for bin in $(BIN); do ./$$bin fail; done
    23 
    24 $(BIN): $(SRC)
    25 	$(CXX) $(CXXFLAGS) -o $(@) $(@).cpp $(LDFLAGS)
    26 
    27 # Blok finally při odchytávání výjimek: C++ vs. Java
    28 # https://blog.frantovo.cz/c/395/