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

81 lines
1.5 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
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=)
2018-05-06 18:42:31 +05:00
SRCS = $(NNTPCHAN_SRC) $(TOOL_SRC)
2018-05-06 17:10:01 +05:00
2017-10-13 16:58:41 +05:00
OBJ := $(NNTPCHAN_OBJ)
TEST = $(REPO)/test
2017-10-11 18:48:27 +05:00
2017-05-03 20:37:09 +05:00
DAEMON_SRC = $(REPO)/daemon
2018-05-06 19:27:55 +05:00
LD_FLAGS ?=
INC_FLAGS = -I$(HEADERS_PATH)
2018-05-06 19:28:30 +05:00
ifeq ($(shell uname -s),FreeBSD)
2018-05-06 19:27:55 +05:00
LD_FLAGS += -lc++fs
INC_FLAGS += /usr/local/include
LD_FLAGS += /usr/local/lib/libsodium.a
2018-05-06 18:42:31 +05:00
else
2018-05-06 19:27:55 +05:00
LD_FLAGS += -lstdc++fs
INC_FLAGS += $(shell pkg-config --cflags libsodium)
LD_FLAGS += $(shell pkg-config --libs --static libsodium)
2018-05-06 18:42:31 +05:00
endif
2016-10-15 18:12:01 +05:00
2017-10-17 19:29:56 +05:00
REQUIRED_CXXFLAGS = -std=c++17 -Wall -Wextra -Werror -pedantic $(INC_FLAGS)
2017-10-13 16:58:41 +05:00
DEBUG = 1
2016-10-15 21:37:59 +05:00
2017-05-03 20:37:09 +05:00
ifeq ($(DEBUG),1)
2017-10-17 19:29:56 +05:00
REQUIRED_CXXFLAGS += -g
2017-05-03 20:37:09 +05:00
endif
2016-10-15 18:12:01 +05:00
2017-10-17 19:29:56 +05:00
CXXFLAGS += $(REQUIRED_CXXFLAGS)
2017-10-11 18:48:27 +05:00
NNTPCHAN_LIB = $(REPO)/libnntpchan.a
2018-05-06 18:42:31 +05:00
LIBS = $(NNTPCHAN_LIB)
2017-05-03 20:37:09 +05:00
EXE = $(REPO)/nntpd
all: build
2018-05-06 17:10:01 +05:00
format:
clang-format -i $(SRCS)
2018-05-04 17:38:34 +05:00
build: $(EXE) tools
2016-10-15 18:12:01 +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
2018-05-04 17:38:34 +05:00
tools: $(TOOLS)
$(TOOLS): $(LIBS)
$(CXX) $(CXXFLAGS) $@.cpp $(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)