-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
71 lines (57 loc) 路 1.75 KB
/
GNUmakefile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# GNU trm --- A transactional POSIX鈥檚 rm command
# Copyright (C) 2024 Wasym A. Alonso
#
# This file is part of trm.
#
# trm is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# trm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with trm. If not, see <http://www.gnu.org/licenses/>.
#
PPO_MKDIR = MKDIR
PPO_CLEAN = CLEAN
PPO_CXX = CXX
PPO_LD = LD
BUILD_DIR = build
HDR_DIR = include
SRC_DIR = src
OUT = trm
OPTIMIZATIONS = -pipe -O3
CXX = clang++
CPPFLAGS = -I $(HDR_DIR)
CXXFLAGS = -std=c++20 -Wall -Wextra -pedantic -Werror $(OPTIMIZATIONS)
LDFLAGS = -lcrypto -static-libgcc -static-libstdc++ $(OPTIMIZATIONS)
SRCS := $(wildcard $(SRC_DIR)/*.cc)
OBJS := $(patsubst $(SRC_DIR)/%.cc, $(BUILD_DIR)/%.o, $(SRCS))
.PHONY: all clean mrproper
all: $(BUILD_DIR) $(OUT)
@:
$(BUILD_DIR):
@echo " $(PPO_MKDIR) $@"
@mkdir -p $@
$(OUT): $(OBJS)
@echo " $(PPO_LD) $@"
@$(CXX) $^ $(LDFLAGS) -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cc
@echo " $(PPO_CXX) $@"
@$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -MD $< -o $@
-include $(BUILD_DIR)/*.d
clean:
@if [ -d $(BUILD_DIR) ]; then \
echo " $(PPO_CLEAN) $(BUILD_DIR)"; \
rm -r $(BUILD_DIR); \
fi
mrproper: clean
@if [ -e $(OUT) ]; then \
echo " $(PPO_CLEAN) $(OUT)"; \
rm $(OUT); \
fi