Commit Diff


commit - 0bef3bb5486fcefceddd8ad884fdb7b3ab9fb65d
commit + 12236cc20eb2921a755b654faa37e064d541d780
blob - 3656c589688f14511ba331055435fe312e1aa917
blob + 800123ec79e4366cbd0ce63078f7039caac10a01
--- Makefile
+++ Makefile
@@ -4,45 +4,54 @@ BIN = gpass
 OBJ = $(BIN:=.o)
 SRC = $(BIN:=.c)
 MAN = $(BIN:=.1)
+M4S = $(BIN:=.m4)
 
 PREFIX ?= $(DESTDIR)/usr/local
 MANPREFIX ?= $(PREFIX)/man
 
+M4 ?= m4
+
 LIBS = -lm
 
 bindir = $(PREFIX)/bin
-man1dir = $(MANPREFIX)/man1
+mandir = $(MANPREFIX)/man1
 sharedir = $(PREFIX)/share
 gpassdir = $(sharedir)/gpass
 
-all: $(BIN)
+all: $(BIN) $(MAN)
 
+.SUFFIXES: .c .o .1 .m4
+
 $(BIN): $(OBJ)
 	$(CC) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
 
 .c.o:
 	$(CC) -std=c99 -pedantic -DPREFIX=\"$(PREFIX)\" $(CFLAGS) $(CPPFLAGS) -c $<
 
+$(MAN): $(M4S)
+
+.m4.1:
+	$(M4) -DPREFIX=$(PREFIX) <$< >$@
+
 install: all
 	mkdir -p $(bindir)
 	install -m 755 $(BIN) $(bindir)
-	mkdir -p $(man1dir)
-	sed s=PREFIX=$(PREFIX)=g <gpass.1 >$(man1dir)/gpass.1
-	cd $(man1dir) && chmod 644 $(MAN)
+	mkdir -p $(mandir)
+	install -m 644 $(MAN) $(mandir)
 	mkdir -p $(gpassdir)
 	install -m 644 eff.long $(gpassdir)
 
 uninstall:
 	cd $(bindir) && rm -f $(BIN)
-	cd $(man1dir) && rm -f $(MAN)
+	cd $(mandir) && rm -f $(MAN)
 	rm -rf $(gpassdir)
 
 clean:
-	-rm -f $(BIN) $(OBJ) *.tar.gz *.core gpass-$(V)
+	-rm -f $(BIN) $(OBJ) $(MAN) *.tar.gz *.core gpass-$(V)
 
 dist: clean
 	mkdir -p gpass-$(V)
-	cp -f CHANGES README Makefile version.mk eff.long $(SRC) $(MAN) gpass-$(V)
+	cp -f CHANGES README Makefile version.mk eff.long $(SRC) $(M4S) gpass-$(V)
 	tar cf - gpass-$(VERSION) | gzip >gpass-$(V).tar.gz
 	rm -rf gpass-$(V)
 
blob - 311505122b174272d1f3f39adcc93e0f0a046c0b (mode 644)
blob + /dev/null
--- gpass.1
+++ /dev/null
@@ -1,47 +0,0 @@
-.Dd May 30, 2023
-.Dt GPASS 1
-.Os
-.Sh NAME
-.Nm gpass
-.Nd generate passphrases
-.Sh SYNOPSIS
-.Nm
-.Op Fl d Ar dict
-.Op Fl e Ar bits
-.Op Fl n Ar num
-.Sh DESCRIPTION
-The utility
-.Nm
-outputs a secure passphrase by randomly choosing an appropriate number of lines
-from a dictionary file, containing whitespace-separated words.
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl d Ar dict
-Use the dictionary
-.Ar dict .
-.It Fl e Ar bits
-Generate a passphrase with at least the specified number of
-.Ar bits
-of entropy.
-Default is 70.
-.It Fl n Ar num
-Generate
-.Ar num
-passphrases instead of just one.
-.El
-.Sh ENVIRONMENT
-.Bl -tag -width PM_PRIVKEY
-.It Ev GPASS_DIC
-Path to the dictionary file to use unless the option
-.Fl d
-is specified.
-.El
-.Sh FILES
-.Bl -tag -width Ds
-.It Pa PREFIX/share/gpass/eff.long
-The default dictionary file.
-.El
-.Sh AUTHORS
-.An Alexander Arkhipov Aq Mt aa@manpager.net .
-.Sh EXIT STATUS
-.Ex -std
blob - /dev/null
blob + 311505122b174272d1f3f39adcc93e0f0a046c0b (mode 644)
--- /dev/null
+++ gpass.m4
@@ -0,0 +1,47 @@
+.Dd May 30, 2023
+.Dt GPASS 1
+.Os
+.Sh NAME
+.Nm gpass
+.Nd generate passphrases
+.Sh SYNOPSIS
+.Nm
+.Op Fl d Ar dict
+.Op Fl e Ar bits
+.Op Fl n Ar num
+.Sh DESCRIPTION
+The utility
+.Nm
+outputs a secure passphrase by randomly choosing an appropriate number of lines
+from a dictionary file, containing whitespace-separated words.
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl d Ar dict
+Use the dictionary
+.Ar dict .
+.It Fl e Ar bits
+Generate a passphrase with at least the specified number of
+.Ar bits
+of entropy.
+Default is 70.
+.It Fl n Ar num
+Generate
+.Ar num
+passphrases instead of just one.
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width PM_PRIVKEY
+.It Ev GPASS_DIC
+Path to the dictionary file to use unless the option
+.Fl d
+is specified.
+.El
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa PREFIX/share/gpass/eff.long
+The default dictionary file.
+.El
+.Sh AUTHORS
+.An Alexander Arkhipov Aq Mt aa@manpager.net .
+.Sh EXIT STATUS
+.Ex -std