update Makefile to best practices
[hw/telemini] / Makefile
1 AM=../altusmetrum
2 SCHEME=$(AM)/scheme
3
4 # intentionally want to rebuild drc and bom on every invocation
5 all:    drc partslist partslist.csv pcb
6
7 drc:    telemini.sch Makefile
8         -gnetlist -g drc2 telemini.sch -o telemini.drc
9
10 partslist:      telemini.sch Makefile
11         gnetlist -g bom -o telemini.unsorted telemini.sch
12         head -n1 telemini.unsorted > partslist
13         tail -n+2 telemini.unsorted | sort >> partslist
14         rm -f telemini.unsorted
15
16 partslist.csv:  telemini.sch Makefile
17         gnetlist -L $(SCHEME) -g partslistgag \
18                 -o telemini.unsorted telemini.sch
19         head -n1 telemini.unsorted > partslist.csv
20         tail -n+2 telemini.unsorted | sort -t \, -k 8 >> partslist.csv
21         rm -f telemini.unsorted
22
23 pcb:    telemini.sch project Makefile
24         gsch2pcb project
25
26 # note that 'gschlas -e foo.sch' will embed all symbols in the schematic, this
27 # might be a really good idea for publishing designs to the web that others
28 # might review?  Like this example from DJ:
29 #
30 #web :
31 #        for i in channel.sch ethernet.sch power.sch mcu.sch; do \
32 #          cp $$i tmp.sch ; \
33 #          gschlas -e tmp.sch ; \
34 #          mv tmp.sch ${WEB}/$$i; \
35 #        done
36
37 # this shoves local work out to the git.gag.com repository
38 push:   
39         git push --mirror
40
41 telemini.xy:    telemini.pcb
42         pcb -x bom telemini.pcb
43
44 telemini.bottom.gbr:    telemini.pcb
45         pcb -x gerber telemini.pcb
46
47 zip:    telemini.bottom.gbr telemini.bottommask.gbr telemini.fab.gbr telemini.top.gbr telemini.topmask.gbr telemini.toppaste.gbr telemini.topsilk.gbr telemini.plated-drill.cnc telemini.xy  Makefile # telemini.xls
48         zip telemini.zip telemini.*.gbr telemini.*.cnc telemini.xy # telemini.xls
49
50 oshpark: telemini.bottom.gbr telemini.bottommask.gbr telemini.top.gbr telemini.topmask.gbr telemini.topsilk.gbr telemini.plated-drill.cnc
51         mv telemini.bottom.gbr bottom\ layer.ger
52         mv telemini.bottommask.gbr bottom\ solder\ mask.ger
53         mv telemini.bottomsilk.gbr bottom\ silk\ screen.ger
54         mv telemini.outline.gbr board\ outline.ger
55         mv telemini.top.gbr top\ layer.ger
56         mv telemini.topmask.gbr top\ solder\ mask.ger
57         mv telemini.topsilk.gbr top\ silk\ screen.ger
58         mv telemini.plated-drill.cnc drills.xln
59         zip telemini-oshpark.zip *.ger *.xln
60
61 stencil:        telemini.bottom.gbr telemini.toppaste.gbr telemini.outline.gbr
62         zip telemini-stencil.zip telemini.toppaste.gbr telemini.outline.gbr
63
64 clean:
65         rm -f *.bom *.drc *.log *~ telemini.ps *.gbr *.cnc *bak* *- *.zip 
66         rm -f *.net *.xy *.cmd *.png partslist partslist.csv *.ger *.xln
67         rm -f *.partslist *.new.pcb *.unsorted telemini.xls muffin-5267.pdf
68
69 muffins: partslist.csv $(AM)/glabels/muffin-short-5267.glabels
70         glabels-3-batch $(AM)/glabels/muffin-short-5267.glabels \
71                 -i partslist.csv -o muffin-5267.ps >/dev/null && \
72                 ps2pdf muffin-5267.ps && rm muffin-5267.ps
73