summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2020-05-26 14:13:31 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2020-05-26 14:13:31 -0700
commit941c75a2b2b674e88bff25ad8f6333097306dcb0 (patch)
tree11468fa515d68f4b66d19a63f43f7e1d6d08b274 /doc
parentac30bd6a5fd352508f95a253e007fe39131ad8fb (diff)
downloadnasm-941c75a2b2b674e88bff25ad8f6333097306dcb0.tar.gz
Makefile portability improvement, build nasmdoc.pdf.xz
Significantly improve the portability/reliability of a general make command. Build a .pdf.xz version of the documentation, using an uncompressed pdf as basis. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.in49
-rwxr-xr-xdoc/pspdf.pl8
2 files changed, 44 insertions, 13 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in
index a076300c..e92437a0 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -2,6 +2,8 @@
# UNIX Makefile for NASM documentation
#
+@SET_MAKE@
+
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
@@ -22,29 +24,39 @@ PERL = perl -I$(srcdir)
PDFOPT = @PDFOPT@
-MKDIR = mkdir
+MKDIR_P = @MKDIR_P@
RM_F = rm -f
RM_RF = rm -rf
CP_F = cp -f
-CP_UF = cp -ufv
+CP_UF = cp -uf
+
+# Optional tools
+XZ = @XZ@
+
+# Optional targets
+XZFILES = @XZFILES@
# Auxiliary files referenced by the HTML files
HTMLAUX = nasmdoc.css local.css nasmlogw.png
SRCS = nasmdoc.src inslist.src changes.src warnings.src version.src
-OUT = html nasmdoc.txt nasmdoc.pdf
+OUT = html nasmdoc.txt nasmdoc.pdf $(XZFILES)
+XZOUT = nasmdoc.pdf.xz
.SUFFIXES:
.SUFFIXES: .pfa .ph
+.PHONY: all xzfiles html clean spotless install
+
all: $(OUT)
+xzfiles: $(XZOUT)
+
inslist.src: inslist.pl ../x86/insns.dat
$(PERL) $(srcdir)/inslist.pl $(srcdir)/../x86/insns.dat
-.PHONY: html nasmdoc.ps
html: $(HTMLAUX)
- $(MKDIR) -p html
+ $(MKDIR_P) html
for f in $(HTMLAUX); do $(CP_UF) "$(srcdir)/$$f" html/; done
$(MAKE) html/nasmdoc0.html
@@ -79,20 +91,37 @@ Fontmap: nasmdoc.ps
@: Generated by side effect
nasmdoc.pdf: nasmdoc.ps pspdf.pl fontpath
- $(PERL) $(srcdir)/pspdf.pl $(PDFOPT) nasmdoc.ps nasmdoc.pdf fontpath
+ $(PERL) $(srcdir)/pspdf.pl \
+ $(PDFOPT) $< $@ fontpath
+
+nasmdoc-raw.pdf: nasmdoc.ps pspdf.pl fontpath
+ $(PERL) $(srcdir)/pspdf.pl -nocompress \
+ $(PDFOPT) $< $@ fontpath
+
+nasmdoc.pdf.xz: nasmdoc-raw.pdf
+ $(RM_F) $@
+ $(XZ) -9e < $< > $@
clean:
-$(RM_F) *.rtf *.hpj *.texi *.gid *.ipf *.dip
-$(RM_F) *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
-$(RM_F) inslist.src version.src fontpath Fontmap
- -$(RM_F) nasmdoc*.ps
+ -$(RM_F) nasmdoc*.ps nasmdoc-raw.pdf
spotless: clean
-$(RM_RF) html info
- -$(RM_F) *.hlp nasmdoc.txt *.inf *.pdf *.dvi
+ -$(RM_F) *.hlp nasmdoc.txt *.inf *.pdf *.pdf.xz *.dvi
install: all
- $(MKDIR) -p $(DESTDIR)$(htmldir)
+ $(MKDIR_P) $(DESTDIR)$(htmldir)
$(INSTALL_DATA) html/* $(DESTDIR)$(htmldir)
- $(MKDIR) -p $(DESTDIR)$(docdir)
+ $(MKDIR_P) $(DESTDIR)$(docdir)
$(INSTALL_DATA) nasmdoc.pdf nasmdoc.txt $(DESTDIR)$(docdir)
+
+#
+# Dummy rules that changes make behavior
+# (at end to avoid confusing non-GNU makes)
+#
+.SECONDARY:
+
+.DELETE_ON_ERROR:
diff --git a/doc/pspdf.pl b/doc/pspdf.pl
index 569f974b..91986413 100755
--- a/doc/pspdf.pl
+++ b/doc/pspdf.pl
@@ -18,7 +18,7 @@ while ($ARGV[0] =~ /^-(.*)$/) {
my $opt = $1;
shift @ARGV;
- if ($opt eq '-nocompress') {
+ if ($opt eq 'nocompress') {
$compress = 0;
}
}
@@ -114,11 +114,13 @@ if (defined($fontpath)) {
$fpopt = "-sFONTPATH${o}" . join($p, @fplist);
}
-my $r = system($gs, "-dCompatibilityLevel${o}1.4",
+my $r = system($gs, "-dCompatibilityLevel${o}1.3",
"-I".File::Spec->curdir(),
"-P-", "-dNOPAUSE", "-dBATCH", "-sDEVICE${o}pdfwrite",
"-sstdout${o}%stderr", "-sOutputFile${o}${out}",
- "-dOptimize${o}true", "-dEmbedAllFonts${o}true",
+ "-dOptimize${o}true",
+ "-dEmbedAllFonts${o}true", "-dSubsetFonts${o}true",
+ "-dMaxSubsetPct${o}100",
$fpopt,
"-dCompressPages${o}" . ($compress ? 'true' : 'false'),
"-dUseFlateCompression${o}true",