bench/Makefile

123 lines
2.9 KiB
Makefile
Raw Normal View History

# Where this Makefile is located
2023-01-21 02:04:58 +02:00
TOP := $(shell dirname "$(abspath $(lastword $(MAKEFILE_LIST)))")
# Up to 16 parallel processes for compiling
CMAKE_BUILD_PARALLEL_LEVEL := $(shell (nproc; echo 16) | sort -n | head -n 1)
2023-01-21 02:04:58 +02:00
CMAKE := cmake
.PHONY: help
help:
@echo
@echo "▌Help"
@echo "▙▄▄▄▄▄"
2023-01-21 02:04:58 +02:00
@echo
@echo "Available targets:"
@echo
2023-01-21 02:04:58 +02:00
@echo " debug: debug build"
@echo " debugc: debug build with clang"
@echo " debugcov: debug build with coverage"
@echo " debugcovc: debug build with coverage with clang"
@echo " release: release build"
@echo " releasec: release build with clang"
@echo " relwithdebinfo: release build with debug info"
@echo " relwithdebinfoc: release build with debug info and clang"
@echo " minsizerel: minimum size release build (-Os)"
@echo " minsizerelc: minimum size release build (-Os) and clang"
@echo
@echo " all: all of the above"
@echo
@echo " distclean: (dc) remove all build files"
2023-01-21 02:04:58 +02:00
@echo
.PHONY: build
build:
( test -d "$(BUILD_DIR)" && cd "$(BUILD_DIR)" && $(MAKE) ) || ( mkdir -p "$(BUILD_DIR)" && cd "$(BUILD_DIR)" && $(CMAKE) -D CMAKE_BUILD_TYPE="$(BUILD_TYPE)" "$(TOP)" && $(MAKE) )
2023-01-21 02:04:58 +02:00
.PHONY: buildc
buildc:
( test -d "$(BUILD_DIR)" && cd "$(BUILD_DIR)" && $(MAKE) ) || ( mkdir -p "$(BUILD_DIR)" && cd "$(BUILD_DIR)" && CC=clang CXX=clang++ $(CMAKE) -D CMAKE_BUILD_TYPE="$(BUILD_TYPE)" "$(TOP)" && $(MAKE) )
2023-01-21 02:04:58 +02:00
.PHONY: debug
debug: BUILD_DIR=$(TOP)/build/debug
debug: BUILD_TYPE=Debug
debug: build
2023-01-21 02:04:58 +02:00
.PHONY: debugc
debugc: BUILD_DIR=$(TOP)/build/debugc
debugc: BUILD_TYPE=Debug
debugc: buildc
2023-01-21 02:04:58 +02:00
.PHONY: debugcov
debugcov: BUILD_DIR=$(TOP)/build/debugcov
debugcov: BUILD_TYPE=DebugCov
debugcov: build
2023-01-21 02:04:58 +02:00
.PHONY: debugcovc
debugcovc: BUILD_DIR=$(TOP)/build/debugcovc
debugcovc: BUILD_TYPE=DebugCov
debugcovc: buildc
2023-01-21 02:04:58 +02:00
.PHONY: release
release: BUILD_DIR=$(TOP)/build/release
release: BUILD_TYPE=Release
release: build
2023-01-21 02:04:58 +02:00
.PHONY: releasec
releasec: BUILD_DIR=$(TOP)/build/releasec
releasec: BUILD_TYPE=Release
releasec: buildc
2023-01-21 02:04:58 +02:00
.PHONY: relwithdebinfo
relwithdebinfo: BUILD_DIR=$(TOP)/build/relwithdebinfo
relwithdebinfo: BUILD_TYPE=RelWithDebInfo
relwithdebinfo: build
2023-01-21 02:04:58 +02:00
.PHONY: relwithdebinfoc
relwithdebinfoc: BUILD_DIR=$(TOP)/build/relwithdebinfoc
relwithdebinfoc: BUILD_TYPE=RelWithDebInfo
relwithdebinfoc: buildc
2023-01-21 02:04:58 +02:00
.PHONY: minsizerel
minsizerel: BUILD_DIR=$(TOP)/build/minsizerel
minsizerel: BUILD_TYPE=MinSizeRel
minsizerel: build
2023-01-21 02:04:58 +02:00
.PHONY: minsizerelc
minsizerelc: BUILD_DIR=$(TOP)/build/minsizerelc
minsizerelc: BUILD_TYPE=MinSizeRel
minsizerelc: buildc
.PHONY: all
all:
make debug
make debugcov
make release
make relwithdebinfo
make minsizerel
make debugc
make debugcovc
make releasec
make relwithdebinfoc
make minsizerelc
.PHONY: distclean
2023-01-21 02:04:58 +02:00
distclean:
-rm -rf "$(TOP)"/build/
2023-01-21 02:04:58 +02:00
dc: distclean