chiark / gitweb /
hostside: more length for bavarian
[trains.git] / pcb / Makefile
1
2 default:        all
3 recurse:        all
4 for-pic:        netlists
5 client:         netlists
6 all:            for-pic panel3.pcb \
7                 points-pin-alloc.lout points-pin-alloc.ps
8
9 o=>$@.new && mv -f $@.new $@
10
11 netlists:       reversers.net detectors.net \
12                 reversers.hole-rep detectors.hole-rep \
13                 both.hole-rep panel3.hole-rep
14
15 # print from pcb(1) as follows:
16 #   File / Print Layout / ...
17 #      select media and offsets: A4
18 #      rotate
19 #      ok
20 #    (If `... exists, use anyway?', Sequence OK)
21 #
22 # then
23 #   make {reversers,detectors}.oprints{-l,-lpr}
24 #   for f in *.oprint-*.ps; do gv -scale -1 -media A4 $f; done
25 #   etc.
26
27 OPRINTS=        %.oprint-copper.ps              \
28                 %.pcb.output_fab.ps             \
29                 %.pcb.output_frontsilk.ps       \
30                 %.oprint-assembly.ps
31
32 %.hole-rep:     %.pcb hole-report.pl
33                 ./hole-report.pl <$< $o
34
35 include reversers.layers.dep
36 include detectors.layers.dep
37 include panel3.layers.dep
38
39 %.zip:          layers.txt.tmpl Makefile
40                 rm -rf $@.d; mkdir -p $@.d
41                 set -e; exec <$<; cd $@.d; perl -pe '                   \
42                         m/^(\S+)\s+(\w+)\s+(\w+)\s+(\S.*)$$/ or die;    \
43                         system "cp ../$*.pcb.output_$$1.$$3 $$2.$$3";   \
44                         die $$? if $$?;                                 \
45                         $$_= sprintf "%-20s %s\n", "$$2.$$3", $$4;      \
46                 ' >readme.txt;                                          \
47                 zip -l ../$@.new *
48                 mv -f $@.new $@
49                 unzip -v $@
50
51 PANEL3_PCBS=    reversers.pcb detectors.pcb detectors.pcb
52
53 panel3.pcb:     pcb-panelise $(PANEL3_PCBS) Makefile
54                 ./$< -g100 $(PANEL3_PCBS) $o
55
56 $*.zip: $*.pcb.output_$$1.$$2/ or die' \
57
58 %.out-ps.tar:
59                 GZIP=-9v tar zvcf $@.gz $*.pcb.output_*.ps
60
61 %.layers.dep:   layers.txt.tmpl Makefile
62                 perl -pe \
63         's/^(\S+)\s+\w+\s+(\w+)\s.*/$*.zip: $*.pcb.output_$$1.$$2/ or die' \
64                         <$< $o
65
66 both.hole-rep:  hole-report.pl reversers.pcb detectors.pcb
67                 ./$^ $o
68
69 %.oprints:      $(OPRINTS)
70                         echo $^ >$@-l-tmp
71
72 %.oprints-l:    $(OPRINTS) %.oprints Makefile
73                         cp $@-tmp $@
74
75 pcboprints:     reversers.oprints-l detectors.oprints-l
76
77 %.oprints-lpr:  %.oprints-l
78                 set -ex; for f in `cat $^`; do lpr $$f; done
79
80 %.distilled.ps: %.ps
81                 ps2ps $< $@
82
83 %.oprint-copper.ps:     %.pcb.output_back.distilled.ps \
84                         %.pcb.output_front.distilled.ps
85                 cat $^ >$@.tmp
86                 ps2ps $@.tmp $@-2.tmp
87                 pstops '2:0(-50mm,0mm)+1(50mm,0mm)' <$@-2.tmp $o
88
89 %.oprint-copper.ps:     Makefile
90
91 %.oprint-assembly.ps:   %.pcb.output_assembly.ps Makefile
92                 pstops -pa4 '0@2(-109mm,-290mm)' <$< $o
93
94 %.net:          %.net-info
95                 sed -e '/^\#/d' <$< $o
96
97 %.net-info:     %.net-spec netlist-expand
98                 ./netlist-expand $< $o
99
100 %.net-spec:     generate-netspec.pl
101                 ./$< $@ $o
102
103 points-pin-alloc.lout: points-pin-alloc-gen points-pin-alloc.setup \
104                         Makefile detectors.net-info reversers.net-info
105                 ./$< reversers:4 detectors:6 $o
106
107 %.ps:           %.lout
108                 lout -s $< $o
109
110 tidy:
111
112 clean:          tidy
113                 -rm -f -- *~ .*~ *.tmp *.new *.layers.dep
114                 -rm -f *.hole-rep *.net *.net-info *.net-spec
115                 -rm -f *.layers.dep panel3.pcb
116                 -rm -f points-pin-alloc.{lout,ps}
117
118 .PRECIOUS:      %.net-info %.net-spec
119 .PRECIOUS:      $(OPRINTS)