mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 18:16:31 +00:00
51 lines
762 B
Makefile
51 lines
762 B
Makefile
|
|
|
|
|
|
MAKEFLAGS := --jobs=$(shell nproc)
|
|
|
|
RELEASE=0
|
|
|
|
ifeq ($(RELEASE),1)
|
|
|
|
CXX_FLAGS = \
|
|
-std=c++23 \
|
|
-O2 \
|
|
-pedantic -pedantic-errors \
|
|
-Wall -Wextra -Wpedantic -Wconversion -Werror\
|
|
|
|
else
|
|
|
|
CXX_FLAGS = \
|
|
-std=c++23 \
|
|
-fsanitize=address,undefined \
|
|
-Og \
|
|
-pedantic -pedantic-errors \
|
|
-Wall -Wextra -Wpedantic -Wconversion -Werror\
|
|
|
|
endif
|
|
|
|
CXX = g++
|
|
|
|
OUT=build/sliger
|
|
|
|
CXX_HEADERS = $(shell find . -name "*.hpp" -type f -printf '%P\n')
|
|
|
|
CXX_SOURCES = $(shell find . -name "*.cpp" -type f -printf '%P\n')
|
|
|
|
CXX_OBJECTS = $(patsubst %.cpp,build/%.o,$(CXX_SOURCES))
|
|
|
|
all: build_dir $(OUT)
|
|
|
|
$(OUT): $(CXX_OBJECTS)
|
|
$(CXX) -o $@ $(CXX_FLAGS) $^
|
|
|
|
build_dir:
|
|
mkdir -p build/
|
|
|
|
build/%.o: %.cpp $(CXX_HEADERS)
|
|
$(CXX) -c -o $@ $(CXX_FLAGS) $<
|
|
|
|
clean:
|
|
rm -rf build/
|
|
|