From: Matthew Monaco <matthew.monaco@0x01b.net> This might be more than it needs to be. I anticipate systemd deciding to provide a crypttab man page at some point so I wanted to be someone flexible here. --- .gitignore | 5 +++++ Makefile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 7cd538a..203f504 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ # Editor Files .*.swp *~ + +# Build Files +cryptmount +*.8 +*.5 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b73df91 --- /dev/null +++ b/Makefile @@ -0,0 +1,50 @@ +BIN ?= cryptmount +MANPAGES := crypttab.5 cryptmount.8 + +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +LIBDIR ?= $(PREFIX)/lib +DATADIR ?= $(PREFIX)/share +MANDIR ?= $(DATADIR)/man + +DOCDIRS := $(addprefix $(DESTDIR)$(MANDIR)/man, 5 8) $(DESTDIR)$(DATADIR)/$(BIN) +HOOKDIRS := $(addprefix $(DESTDIR)$(LIBDIR)/initcpio/, install hooks) + + +all: $(BIN) $(MANPAGES) + + +$(BIN): $(BIN).sh + cp $< $@ + +man: $(MANPAGES) + +%.5: %.5.txt + a2x -d manpage -f manpage $< + +%.8: %.8.txt + a2x -d manpage -f manpage $< + + +install: install_bin install_doc + +install_bin: $(BIN) $(DESTDIR)$(BINDIR) + install -m755 -t $(DESTDIR)$(BINDIR) $(BIN) + +install_doc: $(MANPAGES) crypttab.example $(DOCDIRS) + install -m644 -t $(DESTDIR)$(MANDIR)/man5 $(filter %.5, $(MANPAGES)) + install -m644 -t $(DESTDIR)$(MANDIR)/man8 $(filter %.8, $(MANPAGES)) + install -m644 -t $(DESTDIR)$(DATADIR)/$(BIN) crypttab.example + +install_hook: archlinux/encrypt_hook archlinux/encrypt_install $(HOOKDIRS) + install -m644 archlinux/encrypt_install $(DESTDIR)$(LIBDIR)/initcpio/install/encrypt2 + install -m644 archlinux/encrypt_hook $(DESTDIR)$(LIBDIR)/initcpio/hooks/encrypt2 + +$(DESTDIR)$(BINDIR) $(HOOKDIRS) $(DOCDIRS): + install -m755 -d $@ + + +clean: + $(RM) $(BIN) $(MANPAGES) + +.PHONY: all man clean install install_bin install_doc install_hook -- 1.7.10.2