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

74 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-13 16:58:41 +05:00
OBJ := $(NNTPCHAN_OBJ)
OBJ += $(MUSTACHE_OBJ)
TEST = $(REPO)/test
2017-10-11 18:48:27 +05:00
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)
2017-10-13 16:58:41 +05:00
CXXFLAGS := -std=c++17 -Wall -Wextra -Werror -pedantic $(INC_FLAGS)
DEBUG = 1
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)
2017-10-13 16:58:41 +05:00
$(CXX) $(CXXFLAGS) $(DAEMON_SRC)/main.cpp $(LIBS) $(LD_FLAGS) -o $(EXE)
2016-10-15 18:12:01 +05:00
2017-10-13 16:58:41 +05:00
$(TOOLS): $(TOOL_SRC) $(LIBS)
$(CXX) $(CXXFLAGS) $< $(LIBS) $(LD_FLAGS) -o $@
2016-10-15 18:12:01 +05:00
2017-10-13 16:58:41 +05:00
build-test: $(LIBS)
$(CXX) -o $(TEST) $(CXXFLAGS) test.cpp $(LIBS) $(LD_FLAGS)
2016-10-18 17:17:40 +05:00
test: build-test
2017-10-13 16:58:41 +05:00
$(TEST)
2016-10-18 17:17:40 +05:00
2016-10-15 18:12:01 +05:00
clean:
2017-10-13 16:58:41 +05:00
$(RM) $(OBJ) $(LIBS) $(EXE) $(TOOLS) $(TEST)