SHOW:
|
|
- or go back to the newest paste.
1 | # | |
2 | # Makefile for generating gerbers and pngs. | |
3 | # Tested on Advanced Circuits barebones, should work for 33 each, | |
4 | # gerbmerge, and Advanced Circuits. Pngs used for the fab modules | |
5 | # and the modella. | |
6 | # | |
7 | # Copyright (C) 2011 Andy Bardagjy. | |
8 | # | |
9 | # This makefile is free software; you can redistribute it and/or | |
10 | # modify it under the terms of the GNU Lesser General Public | |
11 | # License as published by the Free Software Foundation; either | |
12 | # version 2.1 of the License, or (at your option) any later version. | |
13 | # | |
14 | # This makefile is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | # Lesser General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU Lesser General Public | |
20 | # License along with this library; if not, write to the Free Software | |
21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
22 | # | |
23 | # Andy Bardagjy | |
24 | # June 21, 2011 | |
25 | # | |
26 | # Atommann | |
27 | # Sept. 30, 2014 - use another kind of file extension scheme | |
28 | # Oct. 13, 2014 - milling layer (GML) | |
29 | # Apr. 16, 2015 - Export the drill file with 2:4 precision for Eagle-7.2. Device is EXCELLON_24. | |
30 | # Apr. 28, 2016 - Support 4-layer boards. i.e. add L2(*.G1) and L3(*.G2) | |
31 | # | |
32 | # TODO | |
33 | # Interesting bug, if there are no holes on the board, the script fails | |
34 | # because no drd file is generated, so... I touch an empty drd file | |
35 | # so the build doesn't fail. This is kinda a kluge... | |
36 | # | |
37 | # If there's no dimension layer, the build fails... | |
38 | # | |
39 | # I should add document export: sch, brd | |
40 | # | |
41 | ||
42 | PROJECT?= helloworld | |
43 | ||
44 | WHITE?= \#FFFFFF | |
45 | BLACK?= \#000000 | |
46 | DPI?= 2400 | |
47 | ||
48 | all: gerbers fab parts | |
49 | ||
50 | # Gerber Top Layer | |
51 | $(PROJECT).GTL: $(PROJECT).brd | |
52 | eagle -X -dGERBER_RS274X -o$(PROJECT).GTL $(PROJECT).brd Top Pads Vias | |
53 | ||
54 | # Gerber Layer L2 | |
55 | $(PROJECT).G1: $(PROJECT).brd | |
56 | eagle -X -dGERBER_RS274X -o$(PROJECT).G1 $(PROJECT).brd Route2 Pads Vias | |
57 | ||
58 | # Gerber Layer L3 | |
59 | $(PROJECT).G2: $(PROJECT).brd | |
60 | eagle -X -dGERBER_RS274X -o$(PROJECT).G2 $(PROJECT).brd Route15 Pads Vias | |
61 | ||
62 | # Gerber Bottom Layer | |
63 | $(PROJECT).GBL: $(PROJECT).brd | |
64 | eagle -X -dGERBER_RS274X -o$(PROJECT).GBL $(PROJECT).brd Bottom Pads Vias | |
65 | ||
66 | # Gerber Top Solder Mask | |
67 | $(PROJECT).GTS: $(PROJECT).brd | |
68 | eagle -X -dGERBER_RS274X -o$(PROJECT).GTS $(PROJECT).brd tStop | |
69 | ||
70 | # Gerber Bottom Solder Mask | |
71 | $(PROJECT).GBS: $(PROJECT).brd | |
72 | eagle -X -dGERBER_RS274X -o$(PROJECT).GBS $(PROJECT).brd bStop | |
73 | ||
74 | # Gerber Top Overlay | |
75 | $(PROJECT).GTO: $(PROJECT).brd | |
76 | eagle -X -dGERBER_RS274X -o$(PROJECT).GTO $(PROJECT).brd Dimension tPlace tNames _tsilk | |
77 | ||
78 | # Gerber Bottom Overlay | |
79 | $(PROJECT).GBO: $(PROJECT).brd | |
80 | eagle -X -dGERBER_RS274X -o$(PROJECT).GBO $(PROJECT).brd Dimension bPlace bNames _bsilk | |
81 | ||
82 | # Gerber Top Paste Mask | |
83 | $(PROJECT).GTP: $(PROJECT).brd | |
84 | eagle -X -dGERBER_RS274X -o$(PROJECT).GTP $(PROJECT).brd tCream | |
85 | ||
86 | # Gerber Bottom Paste Mask | |
87 | $(PROJECT).GBP: $(PROJECT).brd | |
88 | eagle -X -dGERBER_RS274X -o$(PROJECT).GBP $(PROJECT).brd bCream | |
89 | ||
90 | # Drills Xcellon | |
91 | $(PROJECT).TXT: $(PROJECT).brd | |
92 | # FIXME This is the drd hack (see top of file) | |
93 | rm -f $(PROJECT).TXT | |
94 | touch $(PROJECT).TXT | |
95 | eagle -X -dEXCELLON_24 -o$(PROJECT).TXT $(PROJECT).brd Drills Holes | |
96 | ||
97 | # Gerber KeepOut/Outline | |
98 | $(PROJECT).GKO: $(PROJECT).brd | |
99 | eagle -X -dGERBER_RS274X -o$(PROJECT).GKO $(PROJECT).brd Dimension | |
100 | ||
101 | # Gerber Milling/cut-out | |
102 | $(PROJECT).GML: $(PROJECT).brd | |
103 | eagle -X -dGERBER_RS274X -o$(PROJECT).GML $(PROJECT).brd Milling | |
104 | ||
105 | # Fab reference Frame | |
106 | $(PROJECT).ref: $(PROJECT).brd | |
107 | eagle -X -dGERBER_RS274X -o$(PROJECT).ref $(PROJECT).brd Reference | |
108 | ||
109 | ||
110 | ||
111 | # Top Copper PNG | |
112 | # So you *can* do this with eagle commands, but the holes don't work out right. | |
113 | # Gotta use gerbv to do this | |
114 | #$(PROJECT)_cmp.png: $(PROJECT).brd | |
115 | # eagle -C "ratsnest; display none Top Pads Vias; export image $(PROJECT)_cmp.png monochrome 600; quit;" $(PROJECT).brd | |
116 | # convert $(PROJECT)_cmp.png -negate $(PROJECT)_cmp.png | |
117 | $(PROJECT)_cmp.png: gerbers | |
118 | gerbv gerbers/$(PROJECT).cmp gerbers/$(PROJECT).ref -b$(BLACK) -f$(WHITE) -f$(BLACK) -B0 -D$(DPI) -o $(PROJECT)_cmp.png -xpng | |
119 | convert $(PROJECT)_cmp.png -colorspace gray +dither -colors 2 -normalize $(PROJECT)_cmp.png | |
120 | convert $(PROJECT)_cmp.png -mattecolor black -frame 25x25 $(PROJECT)_cmp.png | |
121 | convert $(PROJECT)_cmp.png -strip $(PROJECT)_cmp.png | |
122 | convert $(PROJECT)_cmp.png -units PixelsPerInch -density $(DPI) $(PROJECT)_cmp.png | |
123 | #convert $(PROJECT)_cmp.png -colorspace RGB $(PROJECT)_cmp.png | |
124 | convert $(PROJECT)_cmp.png -type TrueColormatte PNG32:$(PROJECT)_cmp.png | |
125 | ||
126 | # Bottom Copper PNG | |
127 | # So you *can* do this with eagle commands, but the holes don't work out right. | |
128 | # Gotta use gerbv to do this | |
129 | $(PROJECT)_sol.png: gerbers | |
130 | gerbv gerbers/$(PROJECT).sol gerbers/$(PROJECT).ref -b$(BLACK) -f$(WHITE) -f$(BLACK) -B0 -D$(DPI) -o $(PROJECT)_sol.png -xpng | |
131 | convert $(PROJECT)_sol.png -colorspace gray +dither -colors 2 -normalize $(PROJECT)_sol.png | |
132 | convert $(PROJECT)_sol.png -mattecolor black -frame 25x25 $(PROJECT)_sol.png | |
133 | convert $(PROJECT)_sol.png -strip $(PROJECT)_sol.png | |
134 | convert $(PROJECT)_sol.png -units PixelsPerInch -density $(DPI) $(PROJECT)_sol.png | |
135 | #convert $(PROJECT)_sol.png -colorspace RGB $(PROJECT)_sol.png | |
136 | convert $(PROJECT)_sol.png -type TrueColormatte PNG32:$(PROJECT)_sol.png | |
137 | ||
138 | # BOARD PNG | |
139 | $(PROJECT)_bor.png: gerbers | |
140 | gerbv gerbers/$(PROJECT).bor gerbers/$(PROJECT).ref -b$(WHITE) -f$(BLACK) -f$(WHITE) -B0 -D$(DPI) -o $(PROJECT)_bor.png -xpng | |
141 | convert $(PROJECT)_bor.png -colorspace gray +dither -colors 2 -normalize $(PROJECT)_bor.png | |
142 | convert $(PROJECT)_bor.png -mattecolor white -frame 25x25 $(PROJECT)_bor.png | |
143 | convert $(PROJECT)_bor.png -strip $(PROJECT)_bor.png | |
144 | convert $(PROJECT)_bor.png -fill black -floodfill +0+0 white $(PROJECT)_bor.png | |
145 | convert $(PROJECT)_bor.png -units PixelsPerInch -density $(DPI) $(PROJECT)_bor.png | |
146 | #convert $(PROJECT)_bor.png -colorspace RGB $(PROJECT)_bor.png | |
147 | convert $(PROJECT)_bor.png -type TrueColormatte PNG32:$(PROJECT)_bor.png | |
148 | ||
149 | ||
150 | # Drills PNG | |
151 | # So you *can* do this with eagle commands, but the holes don't work out right. | |
152 | # Gotta use gerbv to do this | |
153 | #$(PROJECT)_drd.png: $(PROJECT).brd | |
154 | # eagle -C "ratsnest; display none Drills Holes Dimension; export image $(PROJECT)_drd.png monochrome 600; quit;" $(PROJECT).brd | |
155 | $(PROJECT)_drd.png: gerbers | |
156 | gerbv gerbers/$(PROJECT).drd gerbers/$(PROJECT).ref -b$(WHITE) -f$(BLACK) -f$(WHITE) -B0 -D$(DPI) -o $(PROJECT)_drd.png -xpng | |
157 | convert $(PROJECT)_drd.png -colorspace gray +dither -colors 2 -normalize $(PROJECT)_drd.png | |
158 | convert $(PROJECT)_drd.png -mattecolor white -frame 25x25 $(PROJECT)_drd.png | |
159 | convert $(PROJECT)_drd.png -strip $(PROJECT)_drd.png | |
160 | convert $(PROJECT)_drd.png -units PixelsPerInch -density $(DPI) $(PROJECT)_drd.png | |
161 | #convert $(PROJECT)_drd.png -colorspace RGB $(PROJECT)_drd.png | |
162 | convert $(PROJECT)_drd.png -type TrueColormatte PNG32:$(PROJECT)_drd.png | |
163 | ||
164 | gerbers: $(PROJECT).GTL $(PROJECT).G1 $(PROJECT).G2 $(PROJECT).GBL $(PROJECT).GTS $(PROJECT).GBS $(PROJECT).GTO $(PROJECT).GBO $(PROJECT).TXT $(PROJECT).GKO $(PROJECT).ref $(PROJECT).GTP $(PROJECT).GBP $(PROJECT).GML | |
165 | mkdir -p gerbers | |
166 | mv $(PROJECT).{GKO,GTL,TXT,dri,gpi,GBL,GTS,GBS,GTO,GBO,GTP,GBP,GML,ref,G1,G2} gerbers/ | |
167 | zip gerbers/$(PROJECT)_fab.zip gerbers/*.{GKO,TXT,GTL,GBL,GTS,GBS,GTO,GBO,GTP,GBP,GML,G1,G2} | |
168 | zip gerbers/$(PROJECT)_barebones.zip gerbers/*.{GKO,TXT,GTL,GBL,GML,G1,G2} | |
169 | ||
170 | # fab: $(PROJECT)_cmp.png $(PROJECT)_drd.png $(PROJECT)_sol.png | |
171 | fab: $(PROJECT)_cmp.png $(PROJECT)_drd.png $(PROJECT)_sol.png $(PROJECT)_bor.png | |
172 | mkdir -p fab | |
173 | # mv $(PROJECT){_cmp.png,_sol.png,_drd.png} fab/ | |
174 | mv $(PROJECT){_cmp.png,_drd.png,_sol.png,_bor.png} fab/ | |
175 | rm -rf gerbers | |
176 | ||
177 | view: gerbers | |
178 | #gerbv gerbers/$(PROJECT).{bor,drd,stc,plc,cmp,sts,pls,sol} & | |
179 | gerbv gerbers/$(PROJECT).{GKO,TXT,GTL,GBL,GTS,GBS,GTO,GBO,GTP,GBP,GML,ref,G1,G2} & | |
180 | ||
181 | parts: $(PROJECT).sch | |
182 | eagle -C "export partlist $(PROJECT).txt; quit;" $(PROJECT).sch | |
183 | eagle_parts $(PROJECT).csv $(PROJECT).txt | |
184 | mkdir parts | |
185 | mv $(PROJECT).{csv,txt} parts | |
186 | ||
187 | clean: | |
188 | rm -rf $(PROJECT).{csv,txt,GKO,GTL,TXT,dri,gpi,GBL,zip,png,path,GBS,GTS,GTO,GBO,GTP,GBP,GML,G1,G2} | |
189 | rm -rf *#* | |
190 | rm -rf gerbers fab parts |