1#
2# UNIX Makefile for NASM documentation
3#
4
5@SET_MAKE@
6
7top_srcdir	= @top_srcdir@
8srcdir		= @srcdir@
9VPATH		= @srcdir@
10prefix		= @prefix@
11exec_prefix	= @exec_prefix@
12bindir		= @bindir@
13mandir		= @mandir@
14docdir		= @docdir@
15htmldir		= @htmldir@
16infodir		= @infodir@
17datarootdir	= @datarootdir@
18
19INSTALL		= @INSTALL@
20INSTALL_PROGRAM	= @INSTALL_PROGRAM@
21INSTALL_DATA	= @INSTALL_DATA@
22
23PERL		= perl -I$(srcdir)
24
25PDFOPT		= @PDFOPT@
26
27MKDIR_P		= @MKDIR_P@
28RM_F		= rm -f
29RM_RF		= rm -rf
30CP_F		= cp -f
31CP_UF		= cp -uf
32
33# Optional tools
34XZ		= @XZ@
35
36# Optional targets
37XZFILES         = @XZFILES@
38
39# Auxiliary files referenced by the HTML files
40HTMLAUX		= nasmdoc.css local.css nasmlogw.png
41
42SRCS		= nasmdoc.src inslist.src changes.src warnings.src version.src
43OUT		= html nasmdoc.txt nasmdoc.pdf $(XZFILES)
44XZOUT           = nasmdoc.pdf.xz
45
46.SUFFIXES:
47.SUFFIXES: .pfa .ph
48
49.PHONY: all xzfiles html clean spotless install
50
51all: $(OUT)
52
53xzfiles: $(XZOUT)
54
55inslist.src: inslist.pl ../x86/insns.dat
56	$(PERL) $(srcdir)/inslist.pl $(srcdir)/../x86/insns.dat
57
58html: $(HTMLAUX)
59	$(MKDIR_P) html
60	for f in $(HTMLAUX); do $(CP_UF) "$(srcdir)/$$f" html/; done
61	$(MAKE) html/nasmdoc0.html
62
63RDSRC = $(PERL) $(srcdir)/rdsrc.pl -I$(srcdir)/
64
65html/nasmdoc0.html: $(SRCS) rdsrc.pl
66	$(RM_F) html/*.html
67	$(RDSRC) -ohtml html nasmdoc.src
68
69nasmdoc.dip: $(SRCS) rdsrc.pl
70	$(RDSRC) dip nasmdoc.src
71
72nasmdoc.txt: $(SRCS) rdsrc.pl
73	$(RDSRC) txt nasmdoc.src
74
75version.src: $(top_srcdir)/version.pl $(top_srcdir)/version
76	$(PERL) $(top_srcdir)/version.pl docsrc \
77		< $(top_srcdir)/version > version.src
78
79nasmdoc.ps: nasmdoc.dip genps.pl afmmetrics.ph ttfmetrics.ph \
80	pswidth.ph nasmlogo.eps psfonts.ph head.ps
81	$(PERL) $(srcdir)/genps.pl -epsdir "$(srcdir)" \
82		-headps $(srcdir)/head.ps \
83		-fontpath fontpath \
84		-fontmap Fontmap \
85		nasmdoc.dip > nasmdoc.ps
86
87fontpath: nasmdoc.ps
88	@: Generated by side effect
89
90Fontmap: nasmdoc.ps
91	@: Generated by side effect
92
93nasmdoc.pdf: nasmdoc.ps pspdf.pl fontpath
94	$(PERL) $(srcdir)/pspdf.pl \
95		$(PDFOPT) $< $@ fontpath
96
97nasmdoc-raw.pdf: nasmdoc.ps pspdf.pl fontpath
98	$(PERL) $(srcdir)/pspdf.pl -nocompress \
99		$(PDFOPT) $< $@ fontpath
100
101nasmdoc.pdf.xz: nasmdoc-raw.pdf
102	$(RM_F) $@
103	$(XZ) -9e < $< > $@
104
105clean:
106	-$(RM_F) *.rtf *.hpj *.texi *.gid *.ipf *.dip
107	-$(RM_F) *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
108	-$(RM_F) inslist.src version.src fontpath Fontmap
109	-$(RM_F) nasmdoc*.ps nasmdoc-raw.pdf
110
111spotless: clean
112	-$(RM_RF) html info
113	-$(RM_F) *.hlp nasmdoc.txt *.inf *.pdf *.pdf.xz *.dvi
114
115install: all
116	$(MKDIR_P) $(DESTDIR)$(htmldir)
117	$(INSTALL_DATA) html/* $(DESTDIR)$(htmldir)
118	$(MKDIR_P) $(DESTDIR)$(docdir)
119	$(INSTALL_DATA) nasmdoc.pdf nasmdoc.txt $(DESTDIR)$(docdir)
120
121#
122# Dummy rules that changes make behavior
123# (at end to avoid confusing non-GNU makes)
124#
125.SECONDARY:
126
127.DELETE_ON_ERROR:
128