File: Makefile

package info (click to toggle)
gocr 0.52-6.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,864 kB
  • sloc: ansic: 18,197; sh: 545; makefile: 339; xml: 20
file content (201 lines) | stat: -rw-r--r-- 6,543 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#
# using convert from ImageMagick instead of my own jconv version v0.2.8
#   to crop the example images
#
# Version: @(#)ImageMagick 4.1.6 99/01/01 cristy@mystic.es.dupont.com
# Copyright: Copyright 1999 E. I. du Pont de Nemours and Company
# ... hmm, convert seems to use a lot of memory, pnmcrop works better
#
# convert -size 640x200 xc:white -pointsize 80 -fill black\
#  -font "FreeMono-Regular" 
#  -draw 'text 2,80  "Hex-qEETWWMM"' 
#  -draw 'text 2,160 "xQÖFig.queft"' a.png # x=36x34 M=(46+2)*46 mono=48
# # -pointsize 14 -font "FreeMono-Regular"   # (2+2+6+3+1)x(7+1) 
# # -pointsize 16 -font "FreeMono-Regular"   # (3+2+7+3+1)x(9+1) 
# # -pointsize 20 -font "FreeMono-Regular"   # (3+3+9+4+1)x(12) 
# # -pointsize 31 -font "FreeMono-Regular"   # (5+4+13+6+1)x(18+1)  WW
# # -pointsize 50 -font "FreeMono-Regular"   # (7+8+23+8+4)x(29+1)  WW
# # -pointsize 60 -font "FreeMono-Regular"   # (9+9+25+11+4)x(29+1)  MM
#  O is 1 pix higher + 1 pix below XHM, W is 1 pix below XHM
#  i-dot is -4 to 2 at FXH-top
#   round chars have 1 pixel above top and below ground-line
# dd if=/dev/urandom bs=57  count=1 status=noxfer 2>/dev/null|base64 # 77x1
# dd if=/dev/urandom bs=285 count=1 status=noxfer 2>/dev/null|base64 # 77x5
# convert -list font | grep Mono # grep Font
#
CROPPG = convert -crop 0x0+1+1

.PHONY: all examples fonts install uninstall clean proper proper_old gif jpg png

all: examples

help:
	echo " make examples       # Fig-examples (very fast)"
	echo " make examples_tex   # TeX-examples (takes lot of time)"
	echo " make [proper|clean] # remove non source stuff"

examples: font21.pcx font22.pcx font23.pcx font24.pcx ex.pcx inverse.pcx\
 rotate45.pcx rnd80.png
	ls -l *.pcx *.png

examples_tex: text.pbm font0.pbm font1.pbm font2.pbm polish.pbm man.pbm
# what about small.pbm? anyone remember?

.SUFFIXES: .ps .tex .dvi .fig .pcx .png .jpg .gif .pbm .gz
.tex.dvi:
	latex $*.tex

.dvi.ps:
	dvips -E -o $*.ps $*.dvi    # -PAPERSIZE=a4

# default font size is 11*mag
# fig2dev can create pcx directly, but only unpacked and incompatible to xli
.fig.pcx:
	fig2dev -L ppm -m 3 $< | ppmtopcx -packed >$@

.fig.pbm:
	fig2dev -L ppm -m 3 $< | ppmtopgm | pgmtopbm -threshold >$@

.fig.png:
	fig2dev -L png -S 4 -m 3 $< >$@

.fig.gif:
	fig2dev -L gif -S 4 -m 3 $< >$@

.fig.jpg:
	fig2dev -L jpeg -S 4 -q 25 -m 3 $< >$@


# some make versions does not set $< in explicit rules (info autoconf)
font21.pcx: font2.fig
	fig2dev -L ppm -m 2 font2.fig | ppmtopcx -packed >$@
	# fig2dev -L pcx -m 2 font2.fig $@

font22.pcx: font2.fig
	fig2dev -L ppm -m 3 font2.fig | ppmtopcx -packed >$@
	# fig2dev -L pcx -m 3 font2.fig $@

font23.jpg: font2.fig
	fig2dev -L jpeg -m 4 font2.fig $@

font23.pgm: font2.fig
	fig2dev -L ppm -m 4 font2.fig | ppmtopgm >$@

font23.pbm: font2.fig
	fig2dev -L ppm -m 4 font2.fig | ppmtopgm | pgmtopbm >$@

font23.gif: font2.fig
	fig2dev -L gif -m 4 font2.fig $@

font23.pnm: font23.gif
	giftopnm $< >$@

font23.pcx: font2.fig
	fig2dev -L ppm -m 4 font2.fig | ppmtopcx -packed >$@

font24.pcx: font2.fig
	fig2dev -L ppm -m 5 font2.fig | ppmtopcx -packed >$@

font.tex: font1.tex
	cp font1.tex font.tex

# unfortunatly gs always creates a4 from boxed-ps, therefore we must crop it
# gs options: pgmraw, pcxmono, laserjet
font0.pbm: font.ps Makefile
	gs -dNOPAUSE -q -r600 -sDEVICE=pbmraw \
	 -sOutputFile=font0.pbm - < font.ps
#	$(CROPPG) font0.pbm font0.pbm
	pnmcrop font0.pbm >a.pbm; mv a.pbm font0.pbm

font1.pbm: font.ps Makefile
	gs -dNOPAUSE -q -r300 -sDEVICE=pbmraw \
	 -sOutputFile=font1.pbm - < font.ps
#	$(CROPPG) font1.pbm font1.pbm
	pnmcrop font1.pbm >a.pbm; mv a.pbm font1.pbm

font2.pbm: font.ps Makefile 
	gs -dNOPAUSE -q -r150 -sDEVICE=pbmraw \
	 -sOutputFile=font2.pbm - < font.ps
#	$(CROPPG) font2.pbm font2.pbm
	pnmcrop font2.pbm >a.pbm; mv a.pbm font2.pbm

polish.pbm: polish.ps Makefile 
	gs -dNOPAUSE -q -r200 -sDEVICE=pbmraw \
	 -sOutputFile=polish.pbm - < polish.ps
#	$(CROPPG) polish.pbm polish.pbm
	pnmcrop polish.pbm >a.pbm; mv a.pbm polish.pbm

text.pbm: text.ps Makefile
	gs -dNOPAUSE -q -r150 -sDEVICE=pbmraw \
	 -sOutputFile=text.pbm - < text.ps
#	 $(CROPPG) text.pbm text.pbm
	pnmcrop text.pbm >a.pbm; mv a.pbm text.pbm
	
small.pbm: small.ps Makefile
	gs -dNOPAUSE -q -r150 -sDEVICE=pbmraw \
	 -sOutputFile=small.pbm - < small.ps
#	 $(CROPPG) text.pbm text.pbm
	pnmcrop small.pbm >a.pbm; mv a.pbm small.pbm

# change this to make a man page to a test.pbm file
man.pbm: Makefile
	man -Tdvi man >man.dvi
	dvips -o man.ps man.dvi
	gs -dNOPAUSE -q -r300 -sDEVICE=pbmraw \
	 -sOutputFile=man.pbm - < man.ps
#	$(CROPPG) man.pbm man.pbm
	pnmcrop man.pbm >a.pbm; mv a.pbm man.pbm
	rm -f man.ps man.dvi

fonts: font0.pbm font1.pbm font2.pbm

clean:
	-rm -f a *.bak *.aux *.log *.dvi man.ps text.ps font.ps polish.ps *~

# two ways to remove examples
# 1) expand all *.gif *.p?m ... and check if basname.fig exist
# 2) expand all *.fig and remove basename.{gif,p?m}
# works only with GnuMake:
suffix:=%.pbm %.pgm %.ppm %.pcx %.png %.gif %.jpg
figobj:= $(filter $(suffix),$(wildcard $(patsubst %.fig,%.*,$(wildcard *.fig))))
# figobj:= $(foreach var,$(wildcard *.p[bgp]m *.pcx *.png *.gif *.jpg),$(if $(wildcard $(basename $(var)).fig),$(var)))
# shell: 
proper: clean
	-rm -f ./font2[1234].{p[bgp]m,pcx,png,gif,jpg}
	-rm -f $(figobj) rnd80.png.txt rnd80.png

proper_old:
	# -rm -f ./{ex,inverse,rotate45,font2[1234]}.{p[bgpna]m,pcx,png,gif,jpg}
	-for xx in *.fig; do\
	 rm -f ./$$(echo $${xx} | sed 's/.fig$$//'){,1,2,3,4}.{p[bgpn]m,pcx,png,gif,jpg} 2>/dev/null;\
	done

gif: $(patsubst %.fig,%.gif,$(wildcard *.fig))
	ls -l *.gif

png: $(patsubst %.fig,%.png,$(wildcard *.fig))
	ls -l *.png

jpg: $(patsubst %.fig,%.jpg,$(wildcard *.fig))
	ls -l *.jpg

# added 2018-09 285=57chars/line*5lines
rnd80.png.txt:
	dd if=/dev/urandom bs=285 count=1 status=noxfer 2>/dev/null\
 | base64 > $@

# convert -list font | grep Font # ToDo: try others Liberation-Mono-Regular ...
#   Nimbus-Mono-Regular DejaVu-Sans-Mono-Book Droid-Sans-Mono-Regular
#   Liberation-Mono-Regular  # small chars are artificial wided
rnd80.png: rnd80.png.txt
	convert -size 3800x600 xc:white -pointsize 80 -fill black\
 -font "FreeMono-Regular"\
 -draw "text 2,80  \"$(shell head -1 <rnd80.png.txt)\""\
 -draw "text 2,160 \"$(shell head -2 <rnd80.png.txt| tail -1)\""\
 -draw "text 2,240 \"$(shell head -3 <rnd80.png.txt| tail -1)\""\
 -draw "text 2,320 \"$(shell head -4 <rnd80.png.txt| tail -1)\""\
 -draw "text 2,400 \"$(shell head -5 <rnd80.png.txt| tail -1)\"" $@ # x=36x34 M=(46+2)*46 mono=48

install:

uninstall: