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.

41 lines
829 B
Makefile
Raw Normal View History

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