Stick parts on the board just to see how big it might be
[hw/telegps] / Makefile
1 PROJECT=telegps
2 AM=../altusmetrum
3 SCHEME=$(AM)/scheme
4 NICKLE=$(AM)/nickle
5 RETAB=nickle $(NICKLE)/retab
6
7 # intentionally want to rebuild drc and bom on every invocation
8 all:    drc pcb partslist partslist.csv partslist.dk partslist.mouser muffin-5267.pdf zip
9
10 drc: $(PROJECT).sch
11         gnetlist -L $(SCHEME) -g drc2 $(PROJECT).sch -o $(PROJECT).drc
12
13 partslist: $(PROJECT).sch
14         gnetlist -L $(SCHEME) -g bom -o $(PROJECT).tabtmp $(PROJECT).sch
15         (head -n1 $(PROJECT).tabtmp; tail -n+2 $(PROJECT).tabtmp | sort) | $(RETAB) > $@ && rm -f $(PROJECT).tabtmp
16
17 partslist.csv: $(PROJECT).sch Makefile
18         gnetlist -L $(SCHEME) -g partslistgag -o $(PROJECT).csvtmp $(PROJECT).sch
19         (head -n1 $(PROJECT).csvtmp; tail -n+2 $(PROJECT).csvtmp | sort -t \, -k 8) > $@ && rm -f $(PROJECT).csvtmp
20
21 partslist.dk: $(PROJECT).sch Makefile $(SCHEME)/gnet-partslist-bom.scm
22         gnetlist -L $(SCHEME) -g partslist-bom -Ovendor=digikey -o $@ $(PROJECT).sch
23
24 partslist.mouser: $(PROJECT).sch Makefile $(SCHEME)/gnet-partslist-bom.scm
25         gnetlist -L $(SCHEME) -g partslist-bom -Ovendor=mouser -o $@ $(PROJECT).sch
26
27 muffin-5267.pdf: partslist.csv $(AM)/glabels/muffin-5267.glabels
28         glabels-3-batch $(AM)/glabels/muffin-5267.glabels -i partslist.csv -o muffin-5267.ps >/dev/null && ps2pdf muffin-5267.ps && rm muffin-5267.ps
29
30 $(PROJECT).pcb: pcb
31
32 pcb:    $(PROJECT).sch project Makefile
33         gsch2pcb project
34
35 # note that 'gschlas -e foo.sch' will embed all symbols in the schematic, this
36 # might be a really good idea for publishing designs to the web that others
37 # might review?  Like this example from DJ:
38 #
39 #web :
40 #        for i in channel.sch ethernet.sch power.sch mcu.sch; do \
41 #          cp $$i tmp.sch ; \
42 #          gschlas -e tmp.sch ; \
43 #          mv tmp.sch ${WEB}/$$i; \
44 #        done
45
46 # this shoves local work out to the git.gag.com repository
47 push:   
48         git push --mirror
49
50 $(PROJECT).xy:  $(PROJECT).pcb
51         pcb -x bom $(PROJECT).pcb
52
53 GERB_FILES=*.gbr *.ger *.cnc
54
55 $(PROJECT).gerb: $(PROJECT).pcb
56         rm -f $(GERB_FILES)
57         pcb -x gerber $(PROJECT).pcb
58         mv $(PROJECT).group1.gbr "$(PROJECT).Internal Plane 1".ger
59         mv $(PROJECT).group2.gbr "$(PROJECT).Internal Plane 2".ger
60         touch $@
61
62 zip: $(PROJECT).zip $(PROJECT)-stencil.zip
63
64 $(PROJECT).zip: $(PROJECT).gerb $(PROJECT).xy
65         rm -f $@
66         zip $(PROJECT).zip $(GERB_FILES)
67
68 $(PROJECT)-stencil.zip: $(PROJECT).gerb
69         rm -f $@
70         zip $@ $(PROJECT).toppaste.gbr $(PROJECT).outline.gbr
71
72 clean:
73         rm -f *.bom *.drc *.log *~ $(PROJECT).ps $(GERB_FILES) $(PROJECT).gerb *bak* *- *.zip 
74         rm -f *.net *.cmd *.png partslist partslist.csv *.xy partslist.dk partslist.mouser muffin-5267.pdf
75         rm -f *.partslist *.new.pcb *.unsorted $(PROJECT).xls