2016-10-15 18:12:01 +05:00
|
|
|
|
2016-10-15 21:37:59 +05:00
|
|
|
EXE = nntpd
|
|
|
|
|
|
|
|
TOOL = nntpchan-tool
|
2016-10-15 18:12:01 +05:00
|
|
|
|
2017-04-14 15:24:53 +05:00
|
|
|
CXX = g++
|
|
|
|
REPO=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
SRC_PATH = $(REPO)/src
|
2016-10-15 18:12:01 +05:00
|
|
|
|
|
|
|
SOURCES := $(wildcard $(SRC_PATH)/*.cpp)
|
|
|
|
HEADERS := $(wildcard $(SRC_PATH)/*.hpp)
|
|
|
|
OBJECTS := $(SOURCES:.cpp=.o)
|
|
|
|
|
2016-10-15 21:37:59 +05:00
|
|
|
PKGS := libuv libsodium
|
2016-10-15 18:12:01 +05:00
|
|
|
|
|
|
|
LD_FLAGS := $(shell pkg-config --libs $(PKGS))
|
2017-04-14 15:24:53 +05:00
|
|
|
INC_FLAGS := $(shell pkg-config --cflags $(PKGS)) -I $(REPO)/src
|
|
|
|
CXXFLAGS := -std=c++11 -Wall -Wextra $(INC_FLAGS) -g
|
2016-10-15 21:37:59 +05:00
|
|
|
|
2017-05-03 17:09:23 +05:00
|
|
|
LIB = libnntpchan.a
|
2016-10-15 18:12:01 +05:00
|
|
|
|
2016-10-15 21:37:59 +05:00
|
|
|
all: $(EXE) $(TOOL)
|
2016-10-15 18:12:01 +05:00
|
|
|
|
2017-05-03 17:09:23 +05:00
|
|
|
$(LIB): $(OBJECTS)
|
2017-05-03 20:01:32 +05:00
|
|
|
$(AR) -r $(LIB) $(OBJECTS)
|
2017-05-03 17:09:23 +05:00
|
|
|
|
|
|
|
$(EXE): $(LIB)
|
|
|
|
$(CXX) -o $(EXE) $(CXXFLAGS) nntpd.cpp $(LIB) $(LD_FLAGS)
|
2016-10-15 18:12:01 +05:00
|
|
|
|
2017-05-03 17:09:23 +05:00
|
|
|
$(TOOL): $(LIB)
|
|
|
|
$(CXX) -o $(TOOL) $(CXXFLAGS) tool.cpp $(LIB) $(LD_FLAGS)
|
2016-10-15 18:12:01 +05:00
|
|
|
|
2017-05-03 17:09:23 +05:00
|
|
|
build-test: $(LIB)
|
|
|
|
$(CXX) -o test $(CXXFLAGS) test.cpp $(LIB) $(LD_FLAGS)
|
2016-10-18 17:17:40 +05:00
|
|
|
|
|
|
|
test: build-test
|
|
|
|
./test
|
|
|
|
|
2016-10-15 18:12:01 +05:00
|
|
|
%.o: src/%.cpp
|
2017-04-14 15:24:53 +05:00
|
|
|
$(CXX) $(CXXFLAGS) -c -o $@
|
2016-10-15 18:12:01 +05:00
|
|
|
|
|
|
|
clean:
|
2017-05-03 17:09:23 +05:00
|
|
|
rm -f $(OBJECTS) $(LIB) $(EXE) $(TOOL) test
|