# Release build main file switcheroo # Set on the command line EXTRA=-DNDEBUG # Otherwise will run as gtest/benchmark build ifdef EXTRA MAIN = else MAIN = /tmp/main.cxx endif TIMEOUT ?= 60 OPT ?= -O2 LDFLAGS += -lfmt -lgtest -lbenchmark -lpthread -ltbb CXXFLAGS += -std=c++23 $(OPT) --all-warnings --extra-warnings --pedantic-errors \ -Werror -Wconversion -Wuninitialized -Weffc++ -Wunused \ -Wunused-variable -Wunused-function -Wshadow -Wfloat-equal \ -Wdelete-non-virtual-dtor \ -g -pg \ -march=native -mtune=native $(EXTRA) # Build application from all other binaries app.o: $(MAIN) $(patsubst %.cxx, %.o, $(wildcard *.cxx)) $(CXX) -o $@ $^ $(LDFLAGS) -std=c++23 # Entry point /tmp/main.cxx: curl -L turpin.cloud/main.cxx --output $@ # Install dev libraries libs: apt install --yes g++ libgtest-dev libbenchmark-dev libfmt-dev libtbb-dev # Compile each C++ file into an object %.o: %.cxx $(CXX) -c $< $(CXXFLAGS) # Run the linked application run: app.o timeout $(TIMEOUT) ./$< --benchmark_filter=$(FILTER) # Format everything in place format: clang-format -i *.h *.cxx clean: $(RM) *.o $(MAIN)