From 72f132b8fb9f2a47b0f723f4dc4eaa4fdb0c45bd Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 23 Apr 2025 08:22:28 +0200 Subject: dev: Improve makefile, add BTB_POSIX, and BTB_WINDOWS macro. - Refactor library code for better maintenance. - Improve code quality by using well known macros for status code. - Don't let the CLI pass when '-' is being passed as argument and is not recognized. Signed-off-by: Amlal El Mahrouss --- makefile | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index 4e3abe4..8884c33 100644 --- a/makefile +++ b/makefile @@ -1,14 +1,23 @@ +SUDO=sudo +GCC=g++ +GCC_MINGW=x86_64-w64-mingw32-g++ +CXXFLAGS=-I./lib -I./vendor +CXXSTD= -std=c++20 +SRC=$(wildcard cli/*.cc) $(wildcard src/*.cc) +OUT=btb +CP=cp .PHONY: build-btb build-btb: - sudo g++ -I./lib -I./vendor $(wildcard cli/*.cc) $(wildcard src/*.cc) -std=c++20 -o btb - sudo cp btb /usr/local/bin + $(SUDO) $(GCC) $(CXXFLAGS) $(SRC) $(CXXSTD) -o $(OUT) + $(SUDO) $(CP) $(OUT) /usr/local/bin .PHONY: build-btb-windows build-btb-windows: - x86_64-w64-mingw32-g++.exe -I./lib -I./vendor $(wildcard cli/*.cc) $(wildcard src/*.cc) -std=c++20 -o btb.exe + $(GCC_MINGW) $(CXXFLAGS) $(SRC) -o $(OUT).exe .PHONY: help help: - @echo "=> build-btb-windows" - @echo "=> build-btb" + @echo "=> help: Show this help message." + @echo "=> build-btb-windows: Build BTB for Windows." + @echo "=> build-btb: Build BTB for POSIX." -- cgit v1.2.3