-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (38 loc) · 845 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Parallel Settings
PARALLEL ?= 1
PRESET ?= gnu
# Compiler Settings
CXX = g++
CXXFLAGS = -std=c++2a -O3 -Wall
# Paths
SRC = src
BUILD = build
# Project Files
SOURCES = $(wildcard $(SRC)/control/*.cc $(SRC)/strings/*.cc $(SRC)/algorithms/*.cc $(SRC)/datastructures/*.cc $(SRC)/math/*.cc) $(SRC)/main.cc
OBJECTS = $(SOURCES:$(SRC)/%.cc=$(BUILD)/%.o)
EXECUTABLE = $(BUILD)/main
# Default (CMake)
all:
cmake --preset $(PRESET)
cmake -S . -B $(BUILD)
# No CMake
nocmake:
$(BUILD) $(EXECUTABLE)
compile:
cmake --preset $(PRESET)
cmake --build $(BUILD) -- -j$(PARALLEL)
# Create Build
$(BUILD):
mkdir -p $(BUILD)
# Linking
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@
# Compiling
$(BUILD)/%.o: $(SRC)/%.cc
mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Cleaning
clean:
rm -rf $(BUILD)
# Phony
.PHONY: all clean