commit 6ed627e548d2acc89b7abb886600518e9ae0eb28
parent c39f4929c1fac1e168b98505d64f0d7cfa840d4b
Author: finwo <finwo@pm.me>
Date: Wed, 29 Apr 2020 10:08:13 +0200
Rewrite the makefile; install manpage during installation as well
Diffstat:
4 files changed, 39 insertions(+), 57 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1 +1,2 @@
text2pdf
+*.o
diff --git a/Makefile b/Makefile
@@ -1,64 +1,35 @@
-#========================================================================
-# Makefile for text2pdf by Nelson Beebe
-# NB: This program requires an ANSI/ISO Standard C compiler, such as
-# GNU gcc.
-#
-# The ".pok" file is a PDF file produced with
-# "text2pdf text2pdf.c > text2pdf.pok" on some master system. Subsequent
-# installations can be verified against this file using "make check".
-# Nelson recommends using "make all check install".
-#
-# [16-Oct-1996]
-#========================================================================
+include config.mk
-# Change this to suit local customs
-BINDIR = /usr/local/bin
+BIN =\
+ text2pdf
-# The rest of this Makefile should not require changes on any UNIX system
-CHMOD = /bin/chmod
+SRC = $(BIN:=.c)
+OBJ = $(BIN:=.o)
+MAN = $(BIN:=.1)
-DIFF = /bin/diff
+all: $(BIN)
-CP = /bin/cp
+$(BIN): $(LIB) $(OBJ)
-RM = /bin/rm -f
+.o:
+ $(CC) $(LDFLAGS) -o $@ $< $(LIB)
-PROGRAM = text2pdf
+.c.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
-SHELL = /bin/sh
-#========================================================================
-
-all: $(PROGRAM)
-
-check: $(PROGRAM) $(PROGRAM).pdf
- @echo "The only differences should be in the /CreationDate lines"
- -$(DIFF) $(PROGRAM).pdf $(PROGRAM).pok
-
-clean mostlyclean:
- -$(RM) *.i
- -$(RM) *.o
- -$(RM) *~
- -$(RM) \#*
- -$(RM) a.out
- -$(RM) core
-
-clobber distclean: clean
- -$(RM) $(PROGRAM)
- -$(RM) $(PROGRAM).pdf
-
-install: all uninstall
- $(CP) $(PROGRAM) $(BINDIR)/$(PROGRAM)
- $(CHMOD) 775 $(BINDIR)/$(PROGRAM)
-
-maintainer-clean: distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
- -$(RM) $(PROGRAM).pok
-
-$(PROGRAM).pdf: $(PROGRAM).c $(PROGRAM)
- ./$(PROGRAM) $(PROGRAM).c >$(PROGRAM).pdf
+install: all
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
+ cd $(DESTDIR)$(PREFIX)/bin && chmod 755 $(BIN)
+ mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+ for m in $(MAN); do sed "s/{{VERSION}}/$(VERSION)/g" < "$$m" > $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done
+ cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN)
uninstall:
- -$(RM) $(BINDIR)/$(PROGRAM)
+ for b in $(BIN); do rm -f $(DESTDIR)$(PREFIX)/bin/"$$b"; done
+ for m in $(MAN); do rm -f $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done
+clean:
+ rm $(BIN)
+ rm $(OBJ)
diff --git a/config.mk b/config.mk
@@ -0,0 +1,10 @@
+VERSION = 1.1
+
+PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/share/man
+
+CC = cc
+AR = ar
+
+CFLAGS = -std=c89 -Wall -O3
+LDFLAGS = -s -O3
diff --git a/text2pdf.1 b/text2pdf.1
@@ -1,6 +1,6 @@
-.TH TEXT2PDF 1 "V1.1, 02/97" "Local command"
+.TH TEXT2PDF 1 "{{VERSION}}, 02/97" "Local command"
.SH NAME
-text2pdf \- traduction d'un fichier texte en un fichier Acrobat PDF
+text2pdf \- translating a text file into an Acrobat PDF file
.SH SYNOPSIS
.B text2pdf
@@ -80,11 +80,11 @@ Backspace character is not processed, so the result of
has not a very nice touch.
.SH AUTHOR
-text2pdf v1.1 (c) Phil Smith, 1996., <pns@cs.nott.ac.uk>
+text2pdf {{VERSION}} (c) Phil Smith, 1996., <pns@cs.nott.ac.uk>
This software can be find at URL:
.ce
http://www.ep.cs.nott.ac.uk/~pns/pdfcorner/text2pdf/
.SH NOTE
-Cette page de man est faite par Bertrand Decouty, fvrier 1997.
+This man page is made by Bertrand Decouty, February 1997.