Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/nntpchan-daemon/Makefile

72 lines
1.6 KiB
Makefile
Raw Normal View History

2016-10-15 18:12:01 +05:00
2017-04-14 15:24:53 +05:00
REPO=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
2017-10-11 18:48:27 +05:00
NNTPCHAN_PATH = $(REPO)/libnntpchan
2016-10-15 18:12:01 +05:00
2017-10-11 18:48:27 +05:00
NNTPCHAN_SRC := $(wildcard $(NNTPCHAN_PATH)/*.cpp)
NNTPCHAN_HDR := $(wildcard $(NNTPCHAN_PATH)/*.hpp)
NNTPCHAN_OBJ := $(NNTPCHAN_SRC:.cpp=.o)
2016-10-15 18:12:01 +05:00
2017-10-11 18:48:27 +05:00
MUSTACHE_PATH = $(REPO)/libmustache
2017-05-03 20:37:09 +05:00
2017-10-11 18:48:27 +05:00
MUSTACHE_SRC := $(wildcard $(MUSTACHE_PATH)/*.cpp)
MUSTACHE_SRC += $(wildcard $(MUSTACHE_PATH)/*/*.cpp)
MUSTACHE_HDR := $(wildcard $(MUSTACHE_PATH)/*.hpp)
MUSTACHE_OBJ := $(MUSTACHE_SRC:.cpp=.o)
HEADERS_PATH=$(REPO)/include
TOOL_PATH := $(REPO)/tools
TOOL_SRC := $(wildcard $(TOOL_PATH)/*.cpp)
2017-05-03 20:37:09 +05:00
TOOLS := $(TOOL_SRC:.cpp=)
2017-10-11 18:48:27 +05:00
OBJ := $(NNTPCHAN_OBJ) $(MUSTACHE_OBJ)
2017-05-03 20:37:09 +05:00
DAEMON_SRC = $(REPO)/daemon
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)) -lstdc++fs
2017-10-11 18:48:27 +05:00
INC_FLAGS := $(shell pkg-config --cflags $(PKGS)) -I$(HEADERS_PATH)
CXXFLAGS := -std=c++17 -Wall -Wextra -pedantic $(INC_FLAGS)
2016-10-15 21:37:59 +05:00
2017-05-03 20:37:09 +05:00
ifeq ($(DEBUG),1)
CXXFLAGS += -g
endif
2016-10-15 18:12:01 +05:00
2017-10-11 18:48:27 +05:00
NNTPCHAN_LIB = $(REPO)/libnntpchan.a
MUSTACHE_LIB = $(REPO)/libmustache.a
LIBS = $(NNTPCHAN_LIB) $(MUSTACHE_LIB)
2017-05-03 20:37:09 +05:00
EXE = $(REPO)/nntpd
all: build
build: $(EXE) $(TOOLS)
2016-10-15 18:12:01 +05:00
2017-10-11 18:48:27 +05:00
$(MUSTACHE_LIB): $(MUSTACHE_OBJ)
$(AR) -r $(MUSTACHE_LIB) $(MUSTACHE_OBJ)
2017-05-03 17:09:23 +05:00
2017-10-11 18:48:27 +05:00
$(NNTPCHAN_LIB): $(NNTPCHAN_OBJ)
$(AR) -r $(NNTPCHAN_LIB) $(NNTPCHAN_OBJ)
2017-05-03 20:37:09 +05:00
2017-10-11 18:48:27 +05:00
$(EXE): $(LIBS)
$(CXX) $(CXXFLAGS) $(DAEMON_SRC)/main.cpp $(NNTPCHAN_LIB) $(LD_FLAGS) -o $(EXE)
$(TOOL_SRC): $(NNTPCHAN_LIB)
2016-10-15 18:12:01 +05:00
2017-05-03 20:37:09 +05:00
$(TOOLS): $(TOOL_SRC)
2017-10-11 18:48:27 +05:00
$(CXX) $(CXXFLAGS) $< $(NNTPCHAN_LIB) $(LD_FLAGS) -o $@
2016-10-15 18:12:01 +05:00
2017-05-03 17:09:23 +05:00
build-test: $(LIB)
2017-10-11 18:48:27 +05:00
$(CXX) -o $(REPO)/test $(CXXFLAGS) test.cpp $(NNTPCHAN_LIB) $(LD_FLAGS)
2016-10-18 17:17:40 +05:00
test: build-test
2017-09-24 17:18:56 +05:00
$(REPO)/test
2016-10-18 17:17:40 +05:00
2016-10-15 18:12:01 +05:00
clean:
2017-10-11 18:48:27 +05:00
rm -f $(OBJ) $(NNTPCHAN_LIB) $(EXE) $(TOOLS)