-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
43 lines (34 loc) · 1.2 KB
/
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
35
36
37
38
39
40
41
42
43
CC=g++
STD=c++17
CFLAGS=-Wall -Wextra -std=$(STD) -pthread
CLIBS=-l chilkat-9.5.0 -I/usr/local/include -L/usr/local/lib -lgumbo
TARGET_NAME=web-crawler
TARGET_PATH=$(BUILD_PATH)/$(TARGET_NAME)
BUILD_PATH=./build
SOURCE_PATH=./src
LIB_PATH=./include
SOURCE_EXT := cpp
SOURCES := $(shell find $(SOURCE_PATH) -path '*.$(SOURCE_EXT)')
OBJECTS := $(patsubst $(SOURCE_PATH)/%,$(BUILD_PATH)/%,$(SOURCES:.$(SOURCE_EXT)=.o))
all: $(TARGET_NAME)
$(BUILD_PATH)/%.o: $(SOURCE_PATH)/%.cpp $(LIB_PATH)/%.hpp
mkdir -p $(@D)
$(CC) -c $(CFLAGS) -o $@ $< $(CLIBS)
$(TARGET_NAME): $(OBJECTS) ./main.cpp
$(CC) $(CFLAGS) -o $(TARGET_PATH) ./main.cpp $(OBJECTS) $(CLIBS)
install:
cd ./third_party/gumbo-parser-0.10.1/ && ./autogen.sh
cd ./third_party/gumbo-parser-0.10.1/ && ./configure
cd ./third_party/gumbo-parser-0.10.1/ && make
cd ./third_party/gumbo-parser-0.10.1/ && make install
clean:
rm -rf $(BUILD_PATH)/*
run:
$(TARGET_PATH) -c ./input/seed -b > ./output/crawler.log
reset:
rm -rf ./output/*.log
rm -rf ./output/*.idx
rm -rf ./output/*.jl
rm -rf ./output/*.tmp
mem:
valgrind --leak-check=full --show-leak-kinds=all --log-file="./output/mem.log" --max-threads=100 $(TARGET_PATH) -c ./input/seed -b > ./output/crawler.log