chiark / gitweb /
a3 handling improved
[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:        ours-a.ps ours-al.ps parts.ps
19 layers:         $(LAYERS)
20 lpages:         $(LPAGES)
21
22 all:            default layers circuit.bom 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
34 long2splita4=pstops -pa3 -d '0(-9cm,-10cm)+0(-0.5cm,-1cm)' <$< $o
35 long2splita4comb=pstops -pa3 -d \
36         '2:0(-9cm,-6cm)+1(-0.5cm,-6cm)'
37 #,0(-9cm,-1cm)+1(-0.5cm,-1cm)'
38
39 # print from pcb(1) as follows:
40 #   File / Print Layout / ...
41 #      select media and offsets: A3
42 #      rotate
43 #      ok
44 #    (If `... exists, use anyway?', Sequence OK)
45
46 OPRINTS=        %.oprint-back.ps        \
47                 %.oprint-front.ps       \
48                 %.oprint-fab.ps         \
49                 %.oprint-frontsilk.ps   \
50                 %.oprint-assembly.ps
51
52 %.oprints:      $(OPRINTS)
53                         echo $^ $o
54
55 pcboprints:     reversers.oprints detectors.oprints
56
57 pcbcombprints:  detectors.oprint-combine.ps reversers.oprint-combine.ps
58
59 %.oprints-lpr:  %.oprints
60                 set -e; for f in `cat $^`; do echo lpr $$f; done
61
62 %.distilled-a3.ps:      %.ps
63                 ps2ps -sPAPERSIZE=a3 $< $@
64
65 %.oprint-combine.ps:    %.pcb.output_back.distilled-a3.ps \
66                         %.pcb.output_front.distilled-a3.ps
67                 cat $^ >$@.tmp
68                 ps2ps $@.tmp $@-2.tmp
69                 $(long2splita4comb) <$@-2.tmp $o
70
71 %.oprint-back.ps:       %.pcb.output_back.ps Makefile
72                 $(long2splita4)
73
74 %.oprint-front.ps:      %.pcb.output_front.ps Makefile
75                 $(long2splita4)
76
77 %.oprint-fab.ps:        %.pcb.output_fab.ps Makefile
78                 $(long2splita4)
79
80 %.oprint-frontsilk.ps:  %.pcb.output_frontsilk.ps Makefile
81                 $(long2splita4)
82
83 %.oprint-assembly.ps:   %.pcb.output_assembly.ps Makefile
84                 pstops -pa3 '0@1.5(-12cm,-29cm)' <$< $o
85
86 # these outputs from pstops are really A4 and can be viewed nicely with
87 #  for f in *.oprint-*.ps; do gv -scale -1 -media A4 $f; done
88
89 %.net:          %.net-info
90                 sed -e '/^\#/d' <$< $o
91
92 %.net-info:     %.net-spec netlist-expand
93                 ./netlist-expand $< $o
94
95 %.net-spec:     generate-netspec.pl
96                 ./$< $@ $o
97
98 %.hex:          %.asm
99                 gpasm -p 18f458 $<
100
101 circuit.bom:    farnell-find $(CIRCUITPARTS)
102                 ./farnell-find bom $(CIRCUITPARTS) $o
103
104 bulkres.bom:    farnell-find $(BULKRESPARTS)
105                 ./farnell-find bom $(BULKRESPARTS) $o
106
107 bulkres-select.partlist:        bulkres-select-gen.pl
108                 ./$^ $o
109
110 bulkres-items.suggest:
111                 cat bulkres-searchout*[0-9] | ./farnell-resistor-convert.pl $o
112
113 bulkres-items.descs:    bulkres-items.suggest
114                 xargs ./farnell-find describe <$< $o
115
116 bulkres-items.partlist:
117                 ./farnell-resistor-convert.pl <bulkres-items.descs MRS25 std $o
118
119 divider-table.txt:      divider-table.pl
120                 ./$< $o
121
122 divider-tables:         divider-table.ps divider-table.txt
123
124 divider-table.ps:       divider-table.txt Makefile
125                 a2ps -o- -R -1 --borders no -B -L"$$(wc -l <$<)" -l158 \
126                  --center-title='E24 resistor ratios and logarithms' <$< $o
127
128 %.d4:           %.m4 $(M4INCS) Makefile
129                 m4 -s <$< $o
130
131 %-a.ps:         %.d4 layout
132                 ./layout <$< $(LAYOUTOPTS) '-E*l' $o
133
134 %-al.ps:        %.d4 layout
135                 ./layout <$< $(LAYOUTOPTS) '-e*C' '-ep=rm' $o
136
137 %-ap.ps:        %.d4 layout
138                 ./layout -S1.0 <$< $(LAYOUTOPTS) '-e*A' '-ep=rm' $o
139
140 ours-l%.ps:     ours.d4 layout
141                 ./layout <$< -l$* $(LAYOUTOPTS) $(XLAYOUTOPTS_LAYER) $o
142
143 ours-e%.ps:     ours.d4 layout
144                 ./layout <$< -l$* -E'=*aRsclMno' \
145                         -e'p=*rm' -e'=5RN' -E'*~=5rsm' -e'p~=5r' -e'*=*l' $o
146
147 ours-p%.ps:     ours.d4 layout
148                 ./layout <$< -l$$(printf %s "$*" | sed -e 's/-/ -P/') \
149                         $(LAYOUTOPTS_PHYS) $(XLAYOUTOPTS_LAYER) $o
150
151 parts.ps:       showlib.d4 layout
152                 ./layout <$< $(LAYOUTOPTS_ALL) $o
153
154 clean:
155                 -rm -f -- *.d4 *.ps farn.* *~ *.new
156                 -rm -f bulkres-*.partlist bulkres-items.suggest *.bom
157                 -rm -f t,*.gnuplot-data t,*.gnuplot-cmd t,gnuplot-fifo
158                 -rm -f t,gnuplots.sh reversers.net reversers.net-info
159                 -rm -f flasher.hex flasher.cod flasher.lst
160
161 .PRECIOUS:      %.net-info %.net-spec
162 .PRECIOUS:      $(OPRINTS)