-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (31 loc) · 745 Bytes
/
Makefile
File metadata and controls
44 lines (31 loc) · 745 Bytes
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
NAME = webserv
CXX = c++
CXXFLAGS = -Wall -Wextra -Werror -std=c++98 -MMD -MP# -g --save-temps
INCFLAGS = $(addprefix -I,$(INCS))
SRCDIR = src
INCDIR = include
TMPDIR = tmp
SRCS = $(shell find $(SRCDIR) -type f -name '*.cpp')
INCS = $(shell find $(INCDIR) -type d)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(TMPDIR)/%.o,$(SRCS))
DEPS = $(OBJS:.o=.d)
.DEFAULT_GOAL = all
-include $(DEPS)
all: $(NAME)
ifeq ($(shell uname),Linux)
sudo chown root:root $(NAME)
sudo chmod +s $(NAME)
endif
$(NAME): $(OBJS)
@$(CXX) -o $@ $^
$(TMPDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(INCFLAGS) $(CXXFLAGS) -c -o $@ $<
clean:
rm -rf $(TMPDIR)
fclean: clean
$(RM) $(NAME)
re:
$(MAKE) -s fclean
$(MAKE) -s all
.PHONY: all clean fclean re