summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/doc/Makefile
blob: 1abd51504e7be55a0c62ae53d57b7a09141429a4 (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
# The installed library directory, change this if necessary:
LIBDIR = ..

DOC = Circuit_macros
DOCSRC = Circuit_macros.tex body.tex defines.tex

PICTEX = \
  ACsymbol.tex \
  AmpTableMan.tex AntennasMan.tex ArrestersMan.tex AudioMan.tex Axes.tex \
  Buffer.tex BigResistor.tex BipMan.tex \
  CctTableMan.tex Composite.tex ConfigA.tex ConfigB.tex ConfigC.tex \
  ConnMan.tex Corners.tex ContactMan.tex ContactsMan.tex \
  Dac.tex Darlington.tex DCsymbol.tex DemultiplexerMan.tex DiodesMan.tex \
  EmarrowsMan.tex FF.tex FlipFlop.tex Flowdiag.tex FusesMan.tex \
  GroundsMan.tex HeadersMan.tex HybridPi.tex JackMan.tex LogicMan.tex \
  Loop.tex MultiplexerMan.tex NPDTMan.tex NLGMan.tex NportMan.tex \
  Oblique.tex OpampMan.tex Opto.tex ParSeries.tex PconnMan.tex \
  Potentiometers.tex RelayMan.tex relaycoilMan.tex Series.tex ShiftRMan.tex \
  Sinus.tex SourcesMan.tex SwitchesMan.tex Taps.tex TgateMan.tex \
  Thermal.tex Tline.tex VariableMan.tex XformMan.tex \
  WindingsMan.tex Workflow.tex bitr.tex bi_trans.tex bistableMan.tex \
  currents.tex eboxdims.tex fbfilter.tex fetMan.tex lrarrows.tex \
  mplex.tex oax.tex quick.tex \
  sampleIC.tex stringdims.tex thyristorMan.tex ujtMan.tex \
  woodchips.tex

VERBATIM = BigResistor2.verb eboxdims.verb
BOXDIMS = AntennasMan.tex bi_trans.tex ConfigA.tex ConfigB.tex ConfigC.tex \
  Corners.tex \
  Dac.tex eboxdims.tex FlipFlop.tex \
  OpampMan.tex ParSeries.tex Sinus.tex stringdims.tex \
  WindingsMan.tex woodchips.tex
# BOXDIMS = $(PICTEX)

LATEX = latex
M4 = m4 -I $(LIBDIR)
# If M4PATH has been set:
M4 = m4

# For gpic
MODE = gpic
PIC = gpic -t
PRE =
POST = ;printf '\\centerline{\\box\\graph}\n'
PST =

# For dpic; comment these to stick with gpic.
MODE = pstricks
PIC = dpic -p
# PIC = $$HOME/dpic/test/dpic -p
# PIC = $$HOME/dpic/p2c/ftp/dpic -p
PRE =
POST =
#POST = ;printf '}%%'
PST = ;printf '\\usepackage{pstricks}\n' >> heading.tex
# PST = ;printf '\\usepackage{tikz}\n' >> heading.tex

SFX = dvi

M4LIBS = $(MODE).m4
.SUFFIXES: .tex .m4
.m4.tex:
	touch $(DOC).dim
	$(M4) $(M4LIBS) $(DOC).dim $*.m4 > $*.pic
	($(PRE) $(PIC) $*.pic $(POST)) > $*.tex

$(DOC).pdf:
	touch mode.tex
	-if grep -q tikz mode.tex ; then true ; else \
           rm mode.tex; make MODE=tikz clean mode.tex ; fi
	make MODE=pgf PIC="dpic -g" LATEX=pdflatex SFX=pdf \
         POST="; printf '\\\\vspace*{-0.5\\\\baselineskip}\\n'" \
         $(DOC).pdf
#  This breaks internal links:
#	optpdf $(DOC).pdf
	chmod 644 $(DOC).pdf
	
$(DOC).ps:
	printf "\n $(DOC).ps:\n\n"
	make MODE=pstricks PIC="dpic -p" LATEX=latex SFX=dvi POST="" $(DOC).dvi
	dvips -t letter $(DOC) -o

$(DOC).$(SFX): mode.tex citations $(PICTEX)
	@printf "\n $(DOC).SFX=$(DOC).$(SFX):\n\n"
	$(LATEX) $(DOC) ; bibtex $(DOC)
    -@if grep -s "Warning: Reference " $(DOC).log ; then \
           @printf "\n Warning:\n\n" ; \
           $(LATEX) $(DOC) ; bibtex $(DOC) ; \
         elif test ! -f $(DOC).$(SFX) ; then\
           @printf "\n No file $(DOC).$(SFX)\n\n" ; \
           $(LATEX) $(DOC) ; bibtex $(DOC) ; fi

ACsymbol.tex DCsymbol.tex:
	touch $(DOC).dim
	$(M4) $(M4LIBS) $(DOC).dim $*.m4 > $*.pic
	$(PRE) $(PIC) $*.pic | sed -e '/end{tikzpicture}/s/$$/%/' > $*.tex

citations: mode.tex $(DOC).bbl $(PICTEX)
	@printf "\n citations:\n\n"
	$(LATEX) $(DOC) ; bibtex $(DOC)
	touch citations

$(DOC).bbl: $(DOC).bib $(DOC).aux
	bibtex $(DOC)

$(DOC).aux: mode.tex $(DOCSRC) heading.tex $(VERBATIM) $(PICTEX)
	@printf "\n $(DOC).aux:\n\n"
	$(LATEX) $(DOC) ; bibtex $(DOC)
	rm -f $(BOXDIMS)
	make $(BOXDIMS)

mode.tex:
	-if test "$(MODE)" = "pstricks" ; then \
	printf "\\usepackage{pstricks}\n" > mode.tex ; else \
	printf "\\usepackage{tikz}\n" > mode.tex ; fi
	printf "\\def\\Version{" >> mode.tex
	sed -e 's/$$/}/' Version.tex >> mode.tex

heading.tex:
	printf '\\documentclass{article}\n' > heading.tex
	printf '\\usepackage{verbatim,url}\n' >> heading.tex
	printf '\\usepackage{multicol}\n' >> heading.tex
	printf '\\usepackage{amssymb,boxdims}\n' >> heading.tex $(PST)

oax.tex tran.tex bitr.tex: oax.m4
	$(M4) $(M4LIBS) $*.m4 > $*.pic
	$(PIC) $*.pic > $*.tex

pics: $(PICTEX)

BigResistor2.verb: BigResistor.m4
	( printf '\\begin{verbatim}\n'; \
           sed -n '/thinlines/,/PE/p' BigResistor.m4 ;\
    printf '\\end{verbatim}\n' ) > BigResistor2.verb

eboxdims.verb: eboxdims.m4
	( printf '\\begin{verbatim}\n' ; \
           sed -e '/thinlines/,$$d' eboxdims.m4 ; \
    printf '.PE\n\\end{verbatim}\n' ) > eboxdims.verb

ex08.m4: ../examples/ex08.m4
	cp ../examples/ex08.m4 ex08.m4

clobber: clean
	rm -f *.dvi Circuit_macros.pdf

clean:
	rm -f *.bbl *.log *.aux *.blg *.toc citations *.verb ex08.m4
	rm -f *.pic $(PICTEX) heading.tex *.dim *.uu Circuit_macros.ps
	rm -f mode.tex Circuit_macros.out *.upa *.upb *.brf Circuit_macros.dvi