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