1#
2# using convert from ImageMagick instead of my own jconv version v0.2.8
3#   to crop the example images
4#
5# Version: @(#)ImageMagick 4.1.6 99/01/01 cristy@mystic.es.dupont.com
6# Copyright: Copyright 1999 E. I. du Pont de Nemours and Company
7# ... hmm, convert seems to use a lot of memory, pnmcrop works better
8CROPPG = convert -crop 0x0+1+1
9
10.PHONY: all examples fonts install uninstall clean proper proper_old gif jpg png
11
12all: examples
13
14help:
15	echo " make examples       # Fig-examples (very fast)"
16	echo " make examples_tex   # TeX-examples (takes lot of time)"
17	echo " make [proper|clean] # remove non source stuff"
18
19examples: font21.pcx font22.pcx font23.pcx font24.pcx ex.pcx inverse.pcx\
20 rotate45.pcx
21	ls -l *.pcx
22
23examples_tex: text.pbm font0.pbm font1.pbm font2.pbm polish.pbm man.pbm
24# what about small.pbm? anyone remember?
25
26.SUFFIXES: .ps .tex .dvi .fig .pcx .png .jpg .gif .pbm .gz
27.tex.dvi:
28	latex $*.tex
29
30.dvi.ps:
31	dvips -E -o $*.ps $*.dvi    # -PAPERSIZE=a4
32
33# default font size is 11*mag
34# fig2dev can create pcx directly, but only unpacked and incompatible to xli
35.fig.pcx:
36	fig2dev -L ppm -m 3 $< | ppmtopcx -packed >$@
37
38.fig.pbm:
39	fig2dev -L ppm -m 3 $< | ppmtopgm | pgmtopbm -threshold >$@
40
41.fig.png:
42	fig2dev -L png -S 4 -m 3 $< >$@
43
44.fig.gif:
45	fig2dev -L gif -S 4 -m 3 $< >$@
46
47.fig.jpg:
48	fig2dev -L jpeg -S 4 -q 25 -m 3 $< >$@
49
50
51# some make versions does not set $< in explicit rules (info autoconf)
52font21.pcx: font2.fig
53	fig2dev -L ppm -m 2 font2.fig | ppmtopcx -packed >$@
54	# fig2dev -L pcx -m 2 font2.fig $@
55
56font22.pcx: font2.fig
57	fig2dev -L ppm -m 3 font2.fig | ppmtopcx -packed >$@
58	# fig2dev -L pcx -m 3 font2.fig $@
59
60font23.jpg: font2.fig
61	fig2dev -L jpeg -m 4 font2.fig $@
62
63font23.pgm: font2.fig
64	fig2dev -L ppm -m 4 font2.fig | ppmtopgm >$@
65
66font23.pbm: font2.fig
67	fig2dev -L ppm -m 4 font2.fig | ppmtopgm | pgmtopbm >$@
68
69font23.gif: font2.fig
70	fig2dev -L gif -m 4 font2.fig $@
71
72font23.pnm: font23.gif
73	giftopnm $< >$@
74
75font23.pcx: font2.fig
76	fig2dev -L ppm -m 4 font2.fig | ppmtopcx -packed >$@
77
78font24.pcx: font2.fig
79	fig2dev -L ppm -m 5 font2.fig | ppmtopcx -packed >$@
80
81font.tex: font1.tex
82	cp font1.tex font.tex
83
84# unfortunatly gs always creates a4 from boxed-ps, therefore we must crop it
85# gs options: pgmraw, pcxmono, laserjet
86font0.pbm: font.ps Makefile
87	gs -dNOPAUSE -q -r600 -sDEVICE=pbmraw \
88	 -sOutputFile=font0.pbm - < font.ps
89#	$(CROPPG) font0.pbm font0.pbm
90	pnmcrop font0.pbm >a.pbm; mv a.pbm font0.pbm
91
92font1.pbm: font.ps Makefile
93	gs -dNOPAUSE -q -r300 -sDEVICE=pbmraw \
94	 -sOutputFile=font1.pbm - < font.ps
95#	$(CROPPG) font1.pbm font1.pbm
96	pnmcrop font1.pbm >a.pbm; mv a.pbm font1.pbm
97
98font2.pbm: font.ps Makefile
99	gs -dNOPAUSE -q -r150 -sDEVICE=pbmraw \
100	 -sOutputFile=font2.pbm - < font.ps
101#	$(CROPPG) font2.pbm font2.pbm
102	pnmcrop font2.pbm >a.pbm; mv a.pbm font2.pbm
103
104polish.pbm: polish.ps Makefile
105	gs -dNOPAUSE -q -r200 -sDEVICE=pbmraw \
106	 -sOutputFile=polish.pbm - < polish.ps
107#	$(CROPPG) polish.pbm polish.pbm
108	pnmcrop polish.pbm >a.pbm; mv a.pbm polish.pbm
109
110text.pbm: text.ps Makefile
111	gs -dNOPAUSE -q -r150 -sDEVICE=pbmraw \
112	 -sOutputFile=text.pbm - < text.ps
113#	 $(CROPPG) text.pbm text.pbm
114	pnmcrop text.pbm >a.pbm; mv a.pbm text.pbm
115
116small.pbm: small.ps Makefile
117	gs -dNOPAUSE -q -r150 -sDEVICE=pbmraw \
118	 -sOutputFile=small.pbm - < small.ps
119#	 $(CROPPG) text.pbm text.pbm
120	pnmcrop small.pbm >a.pbm; mv a.pbm small.pbm
121
122# change this to make a man page to a test.pbm file
123man.pbm: Makefile
124	man -Tdvi man >man.dvi
125	dvips -o man.ps man.dvi
126	gs -dNOPAUSE -q -r300 -sDEVICE=pbmraw \
127	 -sOutputFile=man.pbm - < man.ps
128#	$(CROPPG) man.pbm man.pbm
129	pnmcrop man.pbm >a.pbm; mv a.pbm man.pbm
130	rm -f man.ps man.dvi
131
132fonts: font0.pbm font1.pbm font2.pbm
133
134clean:
135	-rm -f a *.bak *.aux *.log *.dvi man.ps text.ps font.ps polish.ps *~
136
137# two ways to remove examples
138# 1) expand all *.gif *.p?m ... and check if basname.fig exist
139# 2) expand all *.fig and remove basename.{gif,p?m}
140# works only with GnuMake:
141suffix:=%.pbm %.pgm %.ppm %.pcx %.png %.gif %.jpg
142figobj:= $(filter $(suffix),$(wildcard $(patsubst %.fig,%.*,$(wildcard *.fig))))
143# figobj:= $(foreach var,$(wildcard *.p[bgp]m *.pcx *.png *.gif *.jpg),$(if $(wildcard $(basename $(var)).fig),$(var)))
144# shell:
145proper: clean
146	-rm -f ./font2[1234].{p[bgp]m,pcx,png,gif,jpg}
147	-rm -f $(figobj)
148
149proper_old:
150	# -rm -f ./{ex,inverse,rotate45,font2[1234]}.{p[bgpna]m,pcx,png,gif,jpg}
151	-for xx in *.fig; do\
152	 rm -f ./$$(echo $${xx} | sed 's/.fig$$//'){,1,2,3,4}.{p[bgpn]m,pcx,png,gif,jpg} 2>/dev/null;\
153	done
154
155gif: $(patsubst %.fig,%.gif,$(wildcard *.fig))
156	ls -l *.gif
157
158png: $(patsubst %.fig,%.png,$(wildcard *.fig))
159	ls -l *.png
160
161jpg: $(patsubst %.fig,%.jpg,$(wildcard *.fig))
162	ls -l *.jpg
163
164install:
165
166uninstall:
167