-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
33 lines (25 loc) · 963 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
SOURCES := $(wildcard src/*.cpp) $(wildcard src/**/*.cpp)
BASE_NAME := phlegethon
ifdef COMSPEC
OUTPUT_NAME ?= $(BASE_NAME).exe
BOOST_LIBS ?= thread program_options system chrono exception
BOOST_FLAGS ?= -DBOOST_THREAD_USE_LIB
LDLIBS ?= $(addprefix -lboost_, $(BOOST_LIBS)) -lwpcap -lws2_32 -lstdc++ -static
else
OUTPUT_NAME ?= $(BASE_NAME)
BOOST_LIBS ?= program_options
LDLIBS ?= $(addprefix -lboost_, $(BOOST_LIBS)) -lpcap -lpthread -lstdc++
endif
DEPFLAGS ?= -MMD -MP -MF .deps/$(basename $<).dep
CPPFLAGS ?= -Wall -O2 -std=c++11 -Isrc/misc $(BOOST_FLAGS)
OBJECTS := $(addsuffix .o, $(addprefix .build/, $(basename $(SOURCES))))
DEPFILES := $(subst .o,.dep, $(subst .build/,.deps/, $(OBJECTS)))
all: $(OUTPUT_NAME)
.build/%.o: %.cpp
@mkdir -p .deps/$(dir $<) .build/$(dir $<)
$(COMPILE.cpp) $(DEPFLAGS) -o $@ $<
$(OUTPUT_NAME): $(OBJECTS)
$(LINK.o) $^ $(LDLIBS) -o $@
clean:
@rm -rf .deps/ .build/ $(OUTPUT_NAME)
-include $(DEPFILES)