fix: add the "all" target in Makefile, cosmetics

Signed-off-by: Doncho N. Gunchev <dgunchev@gmail.com>
This commit is contained in:
Doncho N. Gunchev 2023-01-21 02:17:29 +02:00
parent 6811032084
commit 22fadc7e55
Signed by: dgunchev
GPG key ID: D30FD19F37E002A9

View file

@ -1,16 +1,18 @@
# Where this Makefile is located
TOP := $(shell dirname "$(abspath $(lastword $(MAKEFILE_LIST)))") TOP := $(shell dirname "$(abspath $(lastword $(MAKEFILE_LIST)))")
CMAKE_BUILD_PARALLEL_LEVEL := $(shell (nproc; echo 128) | sort -n | head -n 1) # Up to 16 parallel processes for compiling
CMAKE_BUILD_PARALLEL_LEVEL := $(shell (nproc; echo 16) | sort -n | head -n 1)
CMAKE := cmake CMAKE := cmake
CCMAKE := ccmake
.PHONY: help .PHONY: help
help: help:
@echo @echo
@echo "| Help" @echo "Help"
@echo "+======" @echo "▙▄▄▄▄▄"
@echo @echo
@echo "Available targets:" @echo "Available targets:"
@echo
@echo " debug: debug build" @echo " debug: debug build"
@echo " debugc: debug build with clang" @echo " debugc: debug build with clang"
@echo " debugcov: debug build with coverage" @echo " debugcov: debug build with coverage"
@ -22,7 +24,9 @@ help:
@echo " minsizerel: minimum size release build (-Os)" @echo " minsizerel: minimum size release build (-Os)"
@echo " minsizerelc: minimum size release build (-Os) and clang" @echo " minsizerelc: minimum size release build (-Os) and clang"
@echo @echo
@echo " distclean: remove all build files" @echo " all: all of the above"
@echo
@echo " distclean: (dc) remove all build files"
@echo @echo
@ -30,55 +34,66 @@ help:
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) ) ( test -d "$(BUILD_DIR)" && cd "$(BUILD_DIR)" && $(MAKE) ) || ( mkdir -p "$(BUILD_DIR)" && cd "$(BUILD_DIR)" && $(CMAKE) -D CMAKE_BUILD_TYPE="$(BUILD_TYPE)" "$(TOP)" && $(MAKE) )
.PHONY: buildc .PHONY: buildc
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) ) ( 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) )
.PHONY: debug .PHONY: debug
debug: BUILD_DIR=$(TOP)/build/debug debug: BUILD_DIR=$(TOP)/build/debug
debug: BUILD_TYPE=Debug debug: BUILD_TYPE=Debug
debug: build debug: build
.PHONY: debugc .PHONY: debugc
debugc: BUILD_DIR=$(TOP)/build/debugc debugc: BUILD_DIR=$(TOP)/build/debugc
debugc: BUILD_TYPE=Debug debugc: BUILD_TYPE=Debug
debugc: buildc debugc: buildc
.PHONY: debugcov .PHONY: debugcov
debugcov: BUILD_DIR=$(TOP)/build/debugcov debugcov: BUILD_DIR=$(TOP)/build/debugcov
debugcov: BUILD_TYPE=DebugCov debugcov: BUILD_TYPE=DebugCov
debugcov: build debugcov: build
.PHONY: debugcovc .PHONY: debugcovc
debugcovc: BUILD_DIR=$(TOP)/build/debugcovc debugcovc: BUILD_DIR=$(TOP)/build/debugcovc
debugcovc: BUILD_TYPE=DebugCov debugcovc: BUILD_TYPE=DebugCov
debugcovc: buildc debugcovc: buildc
.PHONY: release .PHONY: release
release: BUILD_DIR=$(TOP)/build/release release: BUILD_DIR=$(TOP)/build/release
release: BUILD_TYPE=Release release: BUILD_TYPE=Release
release: build release: build
.PHONY: releasec .PHONY: releasec
releasec: BUILD_DIR=$(TOP)/build/releasec releasec: BUILD_DIR=$(TOP)/build/releasec
releasec: BUILD_TYPE=Release releasec: BUILD_TYPE=Release
releasec: buildc releasec: buildc
.PHONY: relwithdebinfo .PHONY: relwithdebinfo
relwithdebinfo: BUILD_DIR=$(TOP)/build/relwithdebinfo relwithdebinfo: BUILD_DIR=$(TOP)/build/relwithdebinfo
relwithdebinfo: BUILD_TYPE=RelWithDebInfo relwithdebinfo: BUILD_TYPE=RelWithDebInfo
relwithdebinfo: build relwithdebinfo: build
.PHONY: relwithdebinfoc .PHONY: relwithdebinfoc
relwithdebinfoc: BUILD_DIR=$(TOP)/build/relwithdebinfoc relwithdebinfoc: BUILD_DIR=$(TOP)/build/relwithdebinfoc
relwithdebinfoc: BUILD_TYPE=RelWithDebInfo relwithdebinfoc: BUILD_TYPE=RelWithDebInfo
relwithdebinfoc: buildc relwithdebinfoc: buildc
.PHONY: minsizerel .PHONY: minsizerel
minsizerel: BUILD_DIR=$(TOP)/build/minsizerel minsizerel: BUILD_DIR=$(TOP)/build/minsizerel
minsizerel: BUILD_TYPE=MinSizeRel minsizerel: BUILD_TYPE=MinSizeRel
minsizerel: build minsizerel: build
.PHONY: minsizerelc .PHONY: minsizerelc
minsizerelc: BUILD_DIR=$(TOP)/build/minsizerelc minsizerelc: BUILD_DIR=$(TOP)/build/minsizerelc
minsizerelc: BUILD_TYPE=MinSizeRel minsizerelc: BUILD_TYPE=MinSizeRel
@ -99,7 +114,9 @@ all:
make minsizerelc make minsizerelc
.PHONY: distclean
distclean: distclean:
-rm -rf "$(TOP)"/build/ -rm -rf "$(TOP)"/build/
.PHONY: distclean
dc: distclean dc: distclean