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