Debian Codegraph @

examples/Makefile

raw symbols SCIP
1 # Examples Makefile
2 #
3 # Type "make" to generate examples.pdf containing many examples.
4 # Type "make clean; make examples.ps" to invoke latex intead of pdflatex.
5 # Type "make <diag>.ps" to make a postscript file from <diag>.m4
6 # It may be necessary to type "make clean" before this or any of the following:
7 # Type "make <diag>.eps" to make an .eps file from <diag>.m4
8 # Type "make <diag>.svg" to make an .svg file from <diag>.m4 using pdf2svg
9 # The following require ImageMagick convert:
10 # Type "make <diag>.png" to make a .png file from <diag>.m4
11 # Type "make <diag>.tif" to make a .tif file from <diag>.m4
12 #
13 # See also: dpv subdirectory for creating svg with dpic -v without LaTeX
14 #
15 # To test the file test.m4, type "make tst" if boxdims is used, otherwise
16 # type "make tst1". In either case the file tst.ps is created.
17 #
18 # There are more examples in the extras directory. Go to that
19 # directory and process them one at a time, or type "make".
20 #
21 # To debug a single diagram in a directory other than this examples
22 # directory, copy this makefile and tst.tex to where you want to work,
23 # redefine LIBDIR (below) appropriately, and type "make <diag>.xxx"
24 # where xxx is one of ps, eps, png, or pdf
25
26 #########################################################################
27
28 # Circuit_macro directory, change this if necessary:
29 # LIBDIR = $$HOME/lib
30 LIBDIR = ..
31
32 # The dpic processor:
33 PIC = dpic
34 #PIC = $$HOME/dpic/bisondev/dpic
35 #PIC = $$HOME/dpic/bison/dpic
36 #PIC = $$HOME/dpic/pascaldev/test/dpic
37 #PIC = $$HOME/dpic/pascal/test/dpic
38
39 #MODE = -p
40 MODE = -g
41
42 #CONF = pstricks.m4
43 CONF = pgf.m4
44
45 # Uncomment for gpic. Use gpic or pic as applicable on your machine:
46 # PIC = gpic
47 # PIC = pic
48 # MODE = -t
49 # CONF = gpic.m4
50
51 # Convert options
52 EPSOPTS =
53 PNGOPTS = -quiet -density 400 -scale 25% -alpha Remove
54
55 # M4 = m4 -I $(LIBDIR)
56 # If environment variable M4PATH has been set to the installation directory:
57 M4 = m4
58
59 DOC = examples
60 TEXPICS = \
61 ABlogix.tex Adder.tex Alogix.tex AmpTable.tex Antennas.tex Arresters.tex \
62 Audio.tex Bip.tex Btree.tex Buttons.tex Byte.tex \
63 Capacitors.tex CanLogic.tex Chips.tex Conn.tex Connectors.tex \
64 Contacts.tex Contact.tex control.tex Crow.tex \
65 csc.tex Csource.tex Decoder.tex \
66 Demultiplexer.tex diamond.tex Dini.tex Diodes.tex Drive.tex \
67 EEP.tex Emarrows.tex Escher.tex EVplugs.tex \
68 ex00.tex ex01.tex ex02.tex ex03.tex ex04.tex ex05.tex ex06.tex ex08.tex \
69 ex09.tex ex10.tex ex11.tex ex12.tex ex15.tex ex16.tex ex17.tex ex18.tex \
70 ex21.tex exp.tex fet.tex Flow.tex Fuses.tex \
71 Geometry.tex GrayCode.tex graysurf.tex Grounds.tex \
72 Headers.tex Heathkit.tex \
73 I2L.tex Incleps.tex Inductors.tex Jack.tex \
74 lcct.tex Logic.tex Loglog.tex MC.tex Mixer.tex MoreTable.tex \
75 MotorControl.tex Multiplexer.tex \
76 NLG.tex NPDT.tex Nport.tex Opamp.tex Optoiso.tex \
77 Pconn.tex Plate.tex PushPull.tex pwrsupply.tex \
78 Quantum.tex quick.tex \
79 random.tex Rectifiers.tex recycle.tex relaycoil.tex Relay.tex \
80 Resistors.tex Rotbox.tex \
81 Schottky.tex sfg.tex shadowed.tex shapes.tex ShiftR.tex Sierpinski.tex \
82 Sixpole.tex \
83 Smithchart.tex Sources.tex SQUID.tex Switches.tex \
84 Tgate.tex Three.tex thyristor.tex TTLnand.tex Tubediags.tex \
85 UNO.tex ujt.tex Variable.tex Windings.tex worm.tex Xform.tex XOR.tex
86
87 # Files that have to be processed twice:
88 BOXDIMS = Btree.tex ex09.tex Crow.tex Incleps.tex Loglog.tex Opamp.tex \
89 random.tex Windings.tex
90
91 #########################################################################
92
93 DVIPSOPTS = -G0 -t letter
94 DIMFILE = $(DOC).dim
95 BS = tr '|' '\134'
96
97 # Might be needed (change latex commands to $(LTX) )
98 # LTX = latex --shell-escape
99 LTX = pdflatex --shell-escape
100
101 PDFLTXSRC=printf "|documentclass[11pt]{standalone}\n\
102 |usepackage{times,boxdims,siunitx,amssymb,tikz,geometry}\n\
103 |geometry{paperwidth=15in,paperheight=14in,margin=1in}\n\
104 |pagestyle{empty}|thispagestyle{empty}\n\
105 |begin{document}|noindent|input{"$*".tex}|end{document}\n" | $(BS)
106
107 # [dvipsnames]{xcolor} defines the colors near the end of:
108 # https://steeven9.github.io/USI-LaTeX/html/packages_hyperref_babel_xcolor3.html
109 # Better: use adjusted colors from http://latexcolor.com/
110
111 LTXFILE=printf "|documentclass[11pt]{article}\n\
112 |usepackage[dvipsnames]{xcolor}\n\
113 |usepackage{times,boxdims,graphicx,pstricks}\n\
114 |usepackage{siunitx}\n\
115 |setlength{|textwidth}{28cm}|setlength{|textheight}{28cm}\n\
116 |setlength{|oddsidemargin}{0pt}|setlength{|evensidemargin}{0pt}\n\
117 |setlength{|hoffset}{-1cm}\n\
118 |pagestyle{empty}|thispagestyle{empty}\n\
119 |newbox|graph\n\
120 |begin{document}\n\
121 |noindent|input{"$*".tex}|box|graph\n\
122 |end{document}\n" | $(BS)
123
124 .SUFFIXES: .ps .dvi .tex .m4 .pic .eps .png .pdf .svg .tif .gif
125 .m4.pic:
126 @touch $(DIMFILE) F_$*.dim
127 $(M4) $(CONF) $(DIMFILE) F_$*.dim $*.m4 > $*.pic
128 .m4.tex:
129 @touch $(DIMFILE) F_$*.dim
130 $(M4) $(CONF) $(DIMFILE) F_$*.dim $*.m4 | $(PIC) $(MODE) > $*.tex
131 .m4.dvi:
132 @touch $(DIMFILE) F_$*.dim
133 $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex
134 @$(LTXFILE) > F_$*.tex
135 latex --quiet F_$*
136 touch F_$*.dim $(DIMFILE)
137 $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex
138 latex --quiet F_$*
139 mv F_$*.dvi $*.dvi
140 rm -f F_*
141 .dvi.ps:
142 dvips $(DVIPSOPTS) $* -o $*.ps
143 chmod 644 $*.ps
144 .m4.ps:
145 @touch $(DIMFILE) F_$*.dim
146 $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex
147 @$(LTXFILE) > F_$*.tex
148 latex --quiet F_$*
149 dvips $(DVIPSOPTS) F_$* -o $*.ps
150 chmod 644 $*.ps
151 rm -f F_*
152 .m4.eps:
153 @touch $(DIMFILE) F_$*.dim
154 $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex
155 @$(LTXFILE) > F_$*.tex
156 latex --quiet F_$*
157 $(M4) pstricks.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -p > $*.tex
158 latex --quiet F_$*
159 dvips F_$* -T128cm,28cm -o $*.ps
160 # Recent changes to PSTricks(?) have clashed with the use of TeXtoEPS
161 # so use ps2epsi
162 ps2epsi $*.ps $*.epsi
163 sed -e '/%%Pages:/d' -e '/BeginPreview/,$$d' $*.epsi \
164 | tr '\015' '\012' > $*.eps
165 sed -e '1,/EndPreview/d' $*.epsi >> $*.eps
166 rm -f F_*
167 .m4.pdf:
168 @touch $(DIMFILE) F_$*.dim
169 $(M4) pgf.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -g > $*.tex
170 @$(PDFLTXSRC) > F_$*.tex
171 pdflatex --quiet F_$*
172 $(M4) pgf.m4 $(DIMFILE) F_$*.dim $*.m4 | $(PIC) -g > $*.tex
173 pdflatex --quiet F_$*
174 mv F_$*.pdf $*.pdf
175 rm -f F_*
176 .m4.png:
177 make $*.pdf
178 convert $(PNGOPTS) $*.pdf $*.png
179 @if test -f $*.png.0 ; then mv $*.png.0 $*.png ; fi
180 # rm $*.pdf
181 .m4.gif:
182 make $*.pdf
183 convert $(GIFOPTS) $*.pdf $*.gif
184 # rm $*.pdf
185 .m4.tif:
186 make $*.pdf
187 convert $(EPSOPTS) $*.pdf $*.tif
188 @if test -f $*.tif.0 ; then mv $*.tif.0 $*.tif ; fi
189 # rm $*.pdf
190 .m4.svg:
191 make $*.pdf
192 dvisvgm --pdf $*.pdf $*.svg
193 chmod 644 $*.svg
194 # rm $*.pdf
195
196
197 #########################################################################
198
199 $(DOC).pdf: clean pdfmode $(DOC).tex files.tex header.tex
200 touch $(DOC).dim
201 make CONF=pgf.m4 MODE=-g DIMFILE=$(DOC).dim pics
202 cp $(LIBDIR)/doc/Version.tex .
203 pdflatex $(DOC)
204 rm -f $(BOXDIMS) ${BOXDIMS:%.tex=%.pic} $(DOC).pdf
205 make CONF=pgf.m4 MODE=-g DIMFILE=$(DOC).dim $(BOXDIMS)
206 pdflatex $(DOC)
207 @printf "\n\n optpdf trims the pdf file\n"
208 optpdf $(DOC).pdf
209
210 rose.pdf: rose.m4
211 m4 pdf.m4 rose.m4 | dpic -d > rose.pdf
212
213 keyboard.svg: keyboard.m4
214 m4 svg.m4 keyboard.m4 | dpic -v > keyboard.svg
215
216 keyboard.pdf: keyboard.svg
217 -conv=`which convert` ; if test "`basename $$conv`" = "convert" ; then \
218 convert keyboard.svg keyboard.pdf ; \
219 else printf '.PS\n "keyboard.pdf requires imagemagick convert"\n.PE\n' \
220 | dpic -d > keyboard.pdf ; fi
221
222 pics: rose.pdf keyboard.pdf $(TEXPICS)
223 touch pics
224
225 $(DOC).ps: psmode $(DOC).dvi
226
227 psmode:
228 printf "|usepackage{pstricks,pst-grad}\n" | $(BS) > mode.tex
229
230 pdfmode:
231 printf "|usepackage{tikz}\n" | $(BS) > mode.tex
232
233 $(DOC).dvi: $(DOC).tex files.tex header.tex psmode
234 touch $(DOC).dim
235 make CONF=pstricks.m4 MODE=-p DIMFILE=$(DOC).dim pics
236 cp $(LIBDIR)/doc/Version.tex .
237 latex $(DOC)
238 rm -f $(BOXDIMS) ${BOXDIMS:%.tex=%.pic} $(DOC).dvi
239 make CONF=pstricks.m4 MODE=-p DIMFILE=$(DOC).dim $(BOXDIMS)
240 latex $(DOC)
241
242 tst:
243 @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' > tst.tex
244 make CONF=pstricks.m4 PIC=dpic MODE=-p test.tex; latex --quiet tst
245 rm -f test.tex test.pic
246 make CONF=pstricks.m4 PIC=dpic MODE=-p test.tex; latex --quiet tst
247 dvips $(DVIPSOPTS) tst -o tst.ps
248
249 tst1:
250 @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' > tst.tex
251 make CONF=pstricks.m4 PIC=dpic MODE=-p test.tex; latex --quiet tst
252 dvips $(DVIPSOPTS) tst -o tst.ps
253
254 tikz:
255 @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' -e 's/pstricks/tikz/' > tst.tex
256 make CONF=pgf.m4 PIC=dpic MODE=-g test.tex; latex --quiet tst
257 dvips $(DVIPSOPTS) tst -o tst.ps
258
259 gpic:
260 @$(LTXFILE) | sed -e 's/{\.tex}/{test.tex}/' > tst.tex
261 rm -f test.tex test.pic
262 make CONF=gpic.m4 PIC=pic MODE=-t test.tex; latex --quiet tst
263 dvips $(DVIPSOPTS) tst -o tst.ps
264
265 echopics:
266 @echo $(TEXPICS)
267
268 testall:
269 (cd mf; make)
270 (cd mpost; make)
271 (cd psfrag; make)
272 (cd dpv; make)
273 (cd xfig; make)
274
275 clobber: clean
276 rm -f *.ps
277 -@for dir in mf mpost pdflatex xfig psfrag svg dev test; \
278 do (if test -d $$dir ; then cd $$dir; make clobber; fi) ; done
279 rm -f *.warn
280 rm -f examples.pdf
281 rm -rf index.html html basenames *.png* dist zips htmlfiles svgfiles
282 rm -rf $(TMP)/Cir* $(ECETMP)/Cir* $(ECEDIR)
283 if test -f Incl.pdf ; then \
284 mv Incl.pdf Incl.pdx; rm -f *.pdf; mv Incl.pdx Incl.pdf ; fi
285 for file in `ls *.tex` ; do \
286 nm=`echo $$file | sed -e "s/\(.*\)\.tex/\1/"` ; \
287 if test -s $$nm.m4 ; then rm -f $$nm.pic $$nm.tex ; fi ; done
288 (cd dpv; make clobber)
289 # @if test -f distmakefile ; then make -f distmakefile clobber ; fi
290
291 clean:
292 @printf "\n\n examples clean:\n\n"
293 rm -f core boxdims.tar.gz pics
294 rm -f *.dvi *.aux *.log *.toc *.blg *.eps *.tif *.epsi eps *-mfpic* *.svg
295 rm -f fig*.tex $(TEXPICS) *.roff *.int *.pic gpic.m4 test.tex xxx* *.fig
296 rm -f rose.pdf
297 rm -f *.dim *.bak rotate.ps tst.ps *.bbl *-pics.ps
298 rm -f *.tfm *[0-9]pk *.png *.svg *.1 *.gif
299 rm -f F_* Version.tex *stackdump *.ico ./.[A-Za-z]*
300 rm -rf distfile distfile.tar.gz mode.tex
301 @printf "\n"
302 # @if test -f distmakefile ; then make -f distmakefile clean ; fi