-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (29 loc) · 875 Bytes
/
Makefile
File metadata and controls
40 lines (29 loc) · 875 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
CC = gcc
CFLAGS = -Wall -g
SRC_DIR = ./src
OUT_DIR = ./build
PARSER_DIR = ./dependencies/http-parser
SRC := $(wildcard $(SRC_DIR)/*.c)
OBJ := $(patsubst $(SRC_DIR)/%.c,$(OUT_DIR)/%.o,$(SRC))
all: build dir
.PHONY: dir
dir:
mkdir -p build
-include dir
build: server
server: $(OBJ) $(PARSER_DIR)/http_parser_g.o
$(CC) $(CFLAGS) -o server $^ -laio
$(OUT_DIR)/list_utils.o: $(SRC_DIR)/list_utils.c
$(CC) $(CFLAGS) -c $^ -o $@
$(OUT_DIR)/path_utils.o: $(SRC_DIR)/path_utils.c
$(CC) $(CFLAGS) -c $^ -o $@
$(OUT_DIR)/server_utils.o: $(SRC_DIR)/server_utils.c $(PARSER_DIR)/http_parser_g.o
$(CC) $(CFLAGS) -c $^ -o $@
$(OUT_DIR)/server.o: $(SRC_DIR)/server.c
$(CC) $(CFLAGS) -c $^ -o $@
$(PARSER_DIR)/http_parser_g.o: $(PARSER_DIR)/http_parser.c
$(MAKE) -C $(PARSER_DIR)/ http_parser_g.o
.PHONY: clean
clean:
rm -f server build/*.o
$(MAKE) -C $(PARSER_DIR)/ clean