-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (28 loc) · 811 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
CC = clang++
BIN = bin
OBJ = obj
SRC = src
TARGET = $(BIN)/trashc
SRCS = $(wildcard $(SRC)/*.cpp)
OBJS = $(patsubst $(SRC)/%.cpp,$(OBJ)/%.o,$(SRCS))
DEPS = $(OBJS:.o=.d)
CC_COMMON = -std=c++20 -march=native -Wall -Wextra -Wconversion -Wshadow -Wpedantic
CC_DEBUG = -g -fsanitize=address,undefined
CC_RELEASE = -O3 -DNDEBUG -Werror
LD_COMMON = -lfmt
LD_DEBUG = -fsanitize=address,undefined
LD_RELEASE =
CCFLAGS = $(CC_COMMON) $(CC_DEBUG)
LDFLAGS = $(LD_COMMON) $(LD_DEBUG)
release: CCFLAGS = $(CC_COMMON) $(CC_RELEASE)
release: LDFLAGS = $(LD_COMMON) $(LD_RELEASE)
debug: $(TARGET)
-include $(DEPS)
release: clean $(TARGET)
$(OBJ)/%.o: $(SRC)/%.cpp
$(CC) -MMD $(CCFLAGS) -c $< -o $@
$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)
.PHONY: clean
clean:
rm -f $(TARGET) $(DEPS) $(OBJS) *.asm *.o *.out