curly/Makefile

58 lines
1.1 KiB
Makefile
Raw Normal View History

2020-09-01 16:12:41 +02:00
BIN := $(shell basename $$(pwd))
MANSECTION := 1
MANPAGE := $(BIN).$(MANSECTION)
SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS))
DEPS := $(subst .cpp,.d,$(SRCS))
CODE := $(wildcard code/*.txt)
2020-09-01 16:12:41 +02:00
CXX ?= g++
PKG_CONFIG ?= pkg-config
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
CONFIGDIR ?= $(PREFIX)/etc
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man/man
DOCDIR ?= $(DATADIR)/$(BIN)/doc
RM := /bin/rm -f
INSTALL := /usr/bin/install -c
CXXFLAGS := $(CXXFLAGS) -Wshadow -Wall -Wpedantic -Wextra -g -fno-strict-aliasing -std=c++17 -pthread
ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0
else
CXXFLAGS += -D NDEBUG -O3
endif
LDLIBS := -lm -lpthread -lcurl -lsclogging
.PHONY: all sync clean install
2020-09-01 16:12:41 +02:00
all: $(BIN) sync
2020-09-01 16:12:41 +02:00
$(BIN): $(OBJS) $(DEPS)
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN)
%.o: %.cpp %.d Makefile
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
sync: $(CODE)
rsync -av code/ pi@www.swiftcoder.nl:/var/www/html/cpp1/
2020-09-01 16:12:41 +02:00
clean:
$(RM) $(OBJS) $(DEPS) $(BIN)
install: $(BIN)
$(INSTALL) -d $(BINDIR)
$(INSTALL) $(BIN) $(BINDIR)
$(INSTALL) -d $(MANDIR)$(MANSECTION)
$(INSTALL) $(MANPAGE) $(MANDIR)$(MANSECTION)