-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (61 loc) · 1.31 KB
/
Makefile
File metadata and controls
75 lines (61 loc) · 1.31 KB
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
72
73
74
75
NAME := webserv
SRCS := $(addprefix src/, \
main.cpp \
ConfigParser.cpp \
CgiHandler.cpp \
CgiProcess.cpp \
FastCgiHandler.cpp \
Location.cpp \
Peer.cpp \
Request.cpp \
Response.cpp \
Server.cpp \
ServerConfig.cpp \
WebServ.cpp \
)
OBJS := $(SRCS:.cpp=.o)
PID_FILE = var/php-fpm.d/tmp/php-fpm.pid
CC := c++
CFLAGS := -Wall -Wextra -Werror -std=c++98 -Iinc/
RM := rm -f
MAKEFLAGS += --no-print-directory
all : $(NAME)
$(NAME) : $(OBJS)
$(CC) $(OBJS) $(CFLAGS) -o $(NAME)
$(info CREATED $(NAME))
%.o : %.cpp
$(CC) $(CFLAGS) -c $< -o $@
$(info CREATED $@)
clean :
$(RM) $(OBJS)
$(info DELETED objects files)
fclean : clean
$(RM) $(NAME)
$(info DELETED $(NAME))
re :
$(MAKE) fclean
$(MAKE) all
info-%:
$(MAKE) --dry-run --always-make $* | grep -v "info"
php-fpm:
bash var/fastCgiInit.sh
php-fpm-clean:
@if [ -f "$(PID_FILE)" ]; then \
PID=$$(cat "$(PID_FILE)"); \
if [ "$$PID" -eq "$$PID" ] 2>/dev/null; then \
echo "Killing process with PID: $$PID"; \
kill "$$PID"; \
if [ $$? -eq 0 ]; then \
echo "Process $$PID has been terminated."; \
else \
echo "Failed to terminate process $$PID."; \
fi \
else \
echo "Invalid PID: $$PID"; \
fi \
else \
echo "PID file not found: $(PID_FILE)"; \
fi
rm -rf var/php-fpm.d/
.PHONY : clean fclean re info- php-fpm
.SILENT :