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