-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
41 lines (29 loc) · 781 Bytes
/
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
CXX = g++ -std=c++11
CXXFLAGS = -g -Wall -Wextra -Wpedantic -Werror -O2
INC=-I./include
SRC=./src
OBJ=bin
PREFIX ?= /usr/local
# Available flags:
# DEBUG: DEBUG outputs from my code
# DEBUG_PROXY: DEBUG outputs from the request parsing
# library
# VERBOSE: Prints some more info
DEBUG=
OBJFILES=$(addprefix $(OBJ)/, $(subst .c,.o, $(subst .cpp,.o, $(subst $(SRC)/,,$(wildcard $(SRC)/*)))))
print-% : ; @echo $* = $($*)
.PHONY: all
all: wotop
wotop: $(OBJFILES)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(INC) -lpthread
$(OBJ):
mkdir -p $(OBJ)
$(OBJ)/%.o: $(SRC)/%.cpp | $(OBJ)
$(CXX) $(CXXFLAGS) $(DEBUG) -c $< -o $@ $(INC)
.PHONY: install
install: wotop
install -Dm755 wotop $(DESTDIR)$(PREFIX)/bin/wotop
.PHONY: clean
clean:
rm -rf $(OBJ)
rm -f wotop