summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/pgf/Makefile
blob: 96a5e9face36bb1169df772cf8e725a288c46b62 (plain)
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
# Makefile for the pgf subdirectory

# Type "make" to produce the examplespgf.pdf file
# Type "make examplespgf.ps" for postscript output
# Type "make tst" to process the file test.m4 and produce tstpgf.ps
# Type "make tst.pdf" to process the file test.m4 and produce tstpgf.pdf

# Where the .m4 libraries are installed.  Change if necessary:
LIBDIR = $$HOME/lib

#---------------------------------------------

# The .m4 circuit_macro libraries used for the examples:
M4MACROS = pgf.m4
M4 = m4 -I $(LIBDIR)

#---------------------------------------------
DOC = examplespgf

FIGS = Adder.tex Alogix.tex ABlogix.tex Antennas.tex Audio.tex AmpTable.tex \
  Bip.tex Btree.tex Byte.tex Buttons.tex \
  CanLogic.tex CctTable.tex Conn.tex Counting.tex Crossbar.tex Crow.tex \
  Csource.tex \
  Decoder.tex Demultiplexer.tex Diodes.tex Drive.tex \
  Emarrows.tex Flow.tex Fuses.tex \
  GrayCode.tex Grounds.tex Headers.tex Heathkit.tex Jack.tex \
  I2L.tex Incleps.tex \
  Logic.tex Loglog.tex MC.tex Mixer.tex MotorControl.tex Multiplexer.tex \
  NLG.tex NPDT.tex Nport.tex \
  Opamp.tex Optoiso.tex Pconn.tex PushPull.tex Quantum.tex \
  Rectifiers.tex Relay.tex Rotbox.tex \
  Schottky.tex Sierpinski.tex ShiftR.tex Sixpole.tex Sources.tex SQUID.tex \
  Switches.tex \
  Tgate.tex Three.tex Timer.tex TTLnand.tex Ttree.tex Tubediags.tex \
  Windings.tex Variable.tex Xform.tex \
  control.tex csc.tex diamond.tex \
  ex00.tex ex01.tex ex02.tex ex03.tex ex04.tex \
  ex05.tex ex06.tex ex08.tex ex09.tex ex10.tex ex11.tex ex12.tex \
  ex15.tex ex16.tex ex17.tex ex18.tex ex21.tex exp.tex \
  fet.tex graysurf.tex lcct.tex pwrsupply.tex quick.tex \
  random.tex recycle.tex rose.tex sfg.tex shapes.tex \
  thyristor.tex ujt.tex worm.tex XOR.tex

# Files using boxdims macros:
BOXDIMS = ex09 Crow Incleps Loglog TTLnand Opamp Ttree Windings

# It is advisable to do `make clean' between test examples.
#---------------------------------------------

DPIC = dpic
# DPIC = $$HOME/dpic/test/dpic

LATEX = latex --quiet
PDFLATEX = pdflatex --quiet

TR = | tr '=' '\134'

.SUFFIXES: .tex .m4 .eps .ps .dim .pdf
.tex.ps:
	$(LATEX) $*
	dvips -Ppdf $*
.m4.tex:
	$(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > $*.tex
#	$(M4) $(M4MACROS) $*.m4 > $*.pic
#	$(DPIC) -g $*.pic > $*.tex
.m4.pdf:
	$(M4) $(M4MACROS) $*.m4 | $(DPIC) -g > test.tex
	$(PDFLATEX) tstpgf
	mv tstpgf.pdf $*.pdf
.m4.dim:
	printf '\\documentclass[11pt]{article}\n' > F$*.tex
	printf '\usepackage{times,boxdims,tikz}\n' >> F$*.tex
	printf '\usepackage[amssymb,Gray,thinqspace,textstyle]{SIunits}\n' >>F$*.tex
	printf '\\begin{document}\\input '$*  >> F$*.tex
	printf '\n\\end{document}\n' >> F$*.tex
	make $*.tex
	touch F$*.dim
	$(M4) $(M4MACROS) F$*.dim $*.m4 | $(DPIC) -g > $*.tex; $(LATEX) F$*
	$(M4) $(M4MACROS) F$*.dim $*.m4 | $(DPIC) -g > $*.tex; $(LATEX) F$*


$(DOC).pdf: Incl.pdf $(DOC).tex
	-if test "$(DOC)"="examplespgf" ; then make exlinks ; fi
	-if test -n "$(BOXDIMS)" ; then \
       for box in $(BOXDIMS) ; do touch F$$box.dim; make $$box.dim ; done; fi
	make $(FIGS)
	$(PDFLATEX) $(DOC)

EXL = exlinks
$(DOC).ps: $(DOC).dvi
	dvips -Ppdf $(DOC)

$(DOC).dvi: Incl.eps.gz $(DOC).tex
	-if test "$(DOC)"="examplespgf" ; then make exlinks ; fi
	make dims $(FIGS)
	$(LATEX) $(DOC)

dims:
	-if test -n "$(BOXDIMS)" ; then \
       for box in $(BOXDIMS) ; do touch F$$box.dim; make $$box.dim ; done; fi
	touch dims

Incl.eps.gz: ../Incl.eps.gz ../Incl.eps.bb
	cp ../Incl.eps.gz .
	cp ../Incl.eps.bb .

Incl.pdf: ../Incl.pdf
	cp ../Incl.pdf .

figs: $(EXL) $(FIGS)

exlinks: Incl.eps.gz
	@echo ""
	@echo 'Ignore "cannot create ... exists" warnings.'
	-@if test ! -f ex11.m4 ; then \
      ls ../*.m4 | sed -e 's/^/ln -s /' -e '/test.m4/d' -e '/quick.m4/d' | sh;\
      ls ../../doc/*.m4 ../*.gz | sed -e 's/^/ln -s /' | sh;\
      fi
	touch $(EXL)

clobber: clean
	rm -f $(DOC).ps test.m4 *.pdf

tstpgf.ps: tst
tst: test.m4
	touch tstpgf.dim
	$(M4) pgf.m4 tstpgf.dim test.m4 \
           > test.pic
	$(DPIC) -g test.pic > test.tex
	$(LATEX) tstpgf
	$(M4) pgf.m4 tstpgf.dim test.m4 \
           > test.pic
	$(DPIC) -g test.pic > test.tex
	$(LATEX) tstpgf
	dvips tstpgf

tst.pdf: test.m4
	touch tstpgf.dim
	$(M4) pgf.m4 tstpgf.dim test.m4 \
           > test.pic
	$(DPIC) -g test.pic > test.tex
	$(PDFLATEX) tstpgf
	$(M4) pgf.m4 tstpgf.dim test.m4 \
           > test.pic
	$(DPIC) -g test.pic > test.tex
	$(PDFLATEX) tstpgf

test.tex: test.m4
	touch tstpgf.dim
	$(M4) pgf.m4 tstpgf.dim test.m4 > test.pic
	$(DPIC) -g test.pic > test.tex

clean:
	rm -f stamp-* $(FIGS) *.dvi *.bb *.gz tstpgf.ps tstpgf.pdf
	rm -f *.out *.pfg Incl.* *.pic
	-if /usr/bin/test -f exlinks ; then \
     ls -l *.m4 | grep '\->' | \
       sed -e 's/^.* \([^ ][^ ]*\) ->.*$$/rm -f \1/' | sh; fi
	rm -f *.log *.ps *.aux *.mp *.[0-9] *.[0-9][0-9] *.mpx *.eps *.dim
	rm -f core log mpxerr* *links figs.* *.dim dims Ftest.* setdim.tex
	rm -f man[0-9]*.pic man[0-9]*.m4 figs.m4 test.1 test.mp test.pic test.tex
	-if test -n "$(BOXDIMS)" ; then for box in $(BOXDIMS) ; do \
      rm -f F$$box.tex $$box.tex ; done; fi