mirror of
https://github.com/AGWA/git-crypt.git
synced 2026-01-16 23:12:10 -08:00
Overhaul Makefile
Support building the man page, but only if HAS_DOCBOOK variable set to "yes"
This commit is contained in:
77
Makefile
77
Makefile
@@ -1,7 +1,9 @@
|
||||
CXX := c++
|
||||
CXXFLAGS := -Wall -pedantic -Wno-long-long -O2
|
||||
LDFLAGS :=
|
||||
PREFIX := /usr/local
|
||||
CXXFLAGS ?= -Wall -pedantic -Wno-long-long -O2
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
MANDIR ?= $(PREFIX)/share/man
|
||||
|
||||
HAS_DOCBOOK ?= no
|
||||
|
||||
OBJFILES = \
|
||||
git-crypt.o \
|
||||
@@ -17,18 +19,71 @@ OBJFILES = \
|
||||
OBJFILES += crypto-openssl.o
|
||||
LDFLAGS += -lcrypto
|
||||
|
||||
all: git-crypt
|
||||
DOCBOOK = xsltproc \
|
||||
--param man.output.in.separate.dir 1 \
|
||||
--stringparam man.output.base.dir man/ \
|
||||
--param man.output.subdirs.enabled 1 \
|
||||
--param man.authors.section.enabled 1 \
|
||||
--nonet \
|
||||
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
|
||||
|
||||
all: build
|
||||
|
||||
#
|
||||
# Build
|
||||
#
|
||||
BUILD_MAN_TARGETS-yes = build-man
|
||||
BUILD_MAN_TARGETS-no =
|
||||
BUILD_TARGETS := build-bin $(BUILD_MAN_TARGETS-$(HAS_DOCBOOK))
|
||||
|
||||
build: $(BUILD_TARGETS)
|
||||
|
||||
build-bin: git-crypt
|
||||
|
||||
git-crypt: $(OBJFILES)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $(OBJFILES) $(LDFLAGS)
|
||||
|
||||
util.o: util.cpp util-unix.cpp util-win32.cpp
|
||||
coprocess.o: coprocess.cpp coprocess-unix.cpp coprocess-win32.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.o git-crypt
|
||||
build-man: man/man1/git-crypt.1
|
||||
|
||||
install: git-crypt
|
||||
install -d $(DESTDIR)$(PREFIX)/bin/
|
||||
install -m 755 git-crypt $(DESTDIR)$(PREFIX)/bin/
|
||||
man/man1/git-crypt.1: man/git-crypt.xml
|
||||
$(DOCBOOK) $<
|
||||
|
||||
.PHONY: all clean install
|
||||
#
|
||||
# Clean
|
||||
#
|
||||
CLEAN_MAN_TARGETS-yes = clean-man
|
||||
CLEAN_MAN_TARGETS-no =
|
||||
CLEAN_TARGETS := clean-bin $(CLEAN_MAN_TARGETS-$(HAS_DOCBOOK))
|
||||
|
||||
clean: $(CLEAN_TARGETS)
|
||||
|
||||
clean-bin:
|
||||
rm -f $(OBJFILES) git-crypt
|
||||
|
||||
clean-man:
|
||||
rm -f man/man1/git-crypt.1
|
||||
|
||||
#
|
||||
# Install
|
||||
#
|
||||
INSTALL_MAN_TARGETS-yes = install-man
|
||||
INSTALL_MAN_TARGETS-no =
|
||||
INSTALL_TARGETS := install-bin $(INSTALL_MAN_TARGETS-$(HAS_DOCBOOK))
|
||||
|
||||
install: $(INSTALL_TARGETS)
|
||||
|
||||
install-bin: build-bin
|
||||
install -d $(DESTDIR)$(BINDIR)
|
||||
install -m 755 git-crypt $(DESTDIR)$(BINDIR)/
|
||||
|
||||
install-man: build-man
|
||||
install -d $(DESTDIR)$(MANDIR)/man1
|
||||
install -m 644 man/man1/git-crypt.1 $(DESTDIR)$(MANDIR)/man1/
|
||||
|
||||
.PHONY: all \
|
||||
build build-bin build-man \
|
||||
clean clean-bin clean-man \
|
||||
install install-bin install-man
|
||||
|
||||
Reference in New Issue
Block a user