chiark / gitweb /
hole reports
[trains.git] / pic.make
1
2 M4INCS=         parts.i4
3
4 E_TRACK=        ArsCLMNo
5 LAYOUTOPTS_ALL= -ep=*Cm
6 LAYOUTOPTS=     -E=*$(E_TRACK) $(LAYOUTOPTS_ALL)
7 LAYOUTOPTS_PHYS= -S1.0 $(LAYOUTOPTS) '-e*A'
8 XLAYOUTOPTS_LAYER= -e'=5AN' -E'*~=5rsm' -e'p~=5r' -e'*~=9C' -e'*=*l'
9
10 LAYERS_LS=      0 10 20
11 LAYERS_PS=      $(addsuffix .ps, $(LAYERS_LS))
12 LAYERS_L=       $(addprefix ours-l, $(LAYERS_PS))
13 LAYERS_E=       $(addprefix ours-e, $(LAYERS_PS))
14 LAYERS=         $(LAYERS_L) $(LAYERS_E)
15
16 LPAGES=  $(foreach x, 0 1 2 3 4 5 6, $(foreach y, 1 2 3 4 5, ours-p0-$xx$y.ps))
17
18 default:        netlists picprogs
19 layers:         $(LAYERS)
20 lpages:         $(LPAGES)
21
22 all:            default layers bulkres.bom divider-tables \
23                 picprogs netlists
24
25 o=>$@.new && mv -f $@.new $@
26
27 CIRCUITPARTS=   control.partlist circuit.partlist
28 BULKRESPARTS=   bulkres-select.partlist bulkres-items.partlist
29
30 picprogs:       flasher.hex flash-all.hex
31
32 netlists:       reversers.net detectors.net \
33                 reversers.hole-rep detectors.hole-rep
34
35 # print from pcb(1) as follows:
36 #   File / Print Layout / ...
37 #      select media and offsets: A4
38 #      rotate
39 #      ok
40 #    (If `... exists, use anyway?', Sequence OK)
41 #
42 # then
43 #   make {reversers,detectors}.oprints{-l,-lpr}
44 #   for f in *.oprint-*.ps; do gv -scale -1 -media A4 $f; done
45 #   etc.
46
47 OPRINTS=        %.oprint-copper.ps              \
48                 %.pcb.output_fab.ps             \
49                 %.pcb.output_frontsilk.ps       \
50                 %.oprint-assembly.ps
51
52 %.hole-rep:     %.pcb hole-report.pl
53                 ./hole-report.pl <$< $o
54
55 %.oprints:      $(OPRINTS)
56                         echo $^ >$@-l-tmp
57
58 %.oprints-l:    $(OPRINTS) %.oprints Makefile
59                         cp $@-tmp $@
60
61 pcboprints:     reversers.oprints-l detectors.oprints-l
62
63 %.oprints-lpr:  %.oprints-l
64                 set -ex; for f in `cat $^`; do lpr $$f; done
65
66 %.distilled.ps: %.ps
67                 ps2ps $< $@
68
69 %.oprint-copper.ps:     %.pcb.output_back.distilled.ps \
70                         %.pcb.output_front.distilled.ps
71                 cat $^ >$@.tmp
72                 ps2ps $@.tmp $@-2.tmp
73                 pstops '2:0(-50mm,0mm)+1(50mm,0mm)' <$@-2.tmp $o
74
75 %.oprint-copper.ps:     Makefile
76
77 %.oprint-assembly.ps:   %.pcb.output_assembly.ps Makefile
78                 pstops -pa4 '0@2(-109mm,-290mm)' <$< $o
79
80 %.net:          %.net-info
81                 sed -e '/^\#/d' <$< $o
82
83 %.net-info:     %.net-spec netlist-expand
84                 ./netlist-expand $< $o
85
86 %.net-spec:     generate-netspec.pl
87                 ./$< $@ $o
88
89 %.hex:          %.asm
90                 gpasm -p 18f458 $<
91
92 circuit.bom:    farnell-find $(CIRCUITPARTS)
93                 ./farnell-find bom $(CIRCUITPARTS) $o
94
95 bulkres.bom:    farnell-find $(BULKRESPARTS)
96                 ./farnell-find bom $(BULKRESPARTS) $o
97
98 bulkres-select.partlist:        bulkres-select-gen.pl
99                 ./$^ $o
100
101 bulkres-items.suggest:
102                 cat bulkres-searchout*[0-9] | ./farnell-resistor-convert.pl $o
103
104 bulkres-items.descs:    bulkres-items.suggest
105                 xargs ./farnell-find describe <$< $o
106
107 bulkres-items.partlist:
108                 ./farnell-resistor-convert.pl <bulkres-items.descs MRS25 std $o
109
110 divider-table.txt:      divider-table.pl
111                 ./$< $o
112
113 divider-tables:         divider-table.ps divider-table.txt
114
115 divider-table.ps:       divider-table.txt Makefile
116                 a2ps -o- -R -1 --borders no -B -L"$$(wc -l <$<)" -l158 \
117                  --center-title='E24 resistor ratios and logarithms' <$< $o
118
119 %.d4:           %.m4 $(M4INCS) Makefile
120                 m4 -s <$< $o
121
122 %-a.ps:         %.d4 layout
123                 ./layout <$< $(LAYOUTOPTS) '-E*l' $o
124
125 %-al.ps:        %.d4 layout
126                 ./layout <$< $(LAYOUTOPTS) '-e*C' '-ep=rm' $o
127
128 %-ap.ps:        %.d4 layout
129                 ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o
130
131 ours-l%.ps:     ours.d4 layout
132                 ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o
133
134 ours-e%.ps:     ours.d4 layout
135                 ./layout <$< -l$* -E'=*aRsclMno' \
136                         -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o
137
138 ours-p%.ps:     ours.d4 layout
139                 ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \
140                         $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o
141
142 parts.ps:       showlib.d4 layout
143                 ./layout <$< $(LAYOUTOPTS_ALL) $o
144
145 clean:
146                 -rm -f -- *.d4 farn.* *~ *.new
147                 -rm -f bulkres-*.partlist bulkres-items.suggest *.bom
148                 -rm -f t,*.gnuplot-data t,*.gnuplot-cmd t,gnuplot-fifo
149                 -rm -f t,gnuplots.sh reversers.net reversers.net-info
150                 -rm -f flasher.hex flasher.cod flasher.lst
151                 -rm -f ours-*.ps parts.ps
152                 -rm -f *.oprint-*.ps
153
154 .PRECIOUS:      %.net-info %.net-spec
155 .PRECIOUS:      $(OPRINTS)