WEB_DIR=/home/kas/html/board/
WEB_FILES=pcb-back.png pcb-front.png schematics.png handlebar.png
GERBER_FILES=\
board.top.gbr \
board.bottom.gbr \
board.topmask.gbr \
board.bottommask.gbr \
board.topsilk.gbr \
board.bottomsilk.gbr \
board.outline.gbr \
board.plated-drill.cnc
all:
@echo "Usage: make [clean|web|gerber|fab|board.pcb]"
clean:
rm -f board.cmd board.jpg board.net board.new.pcb board.pcb- \
board.png board.ps board.sch~ pcb-back.png pcb-front.png \
schematics.png *.gbr *.cnc
web: $(WEB_FILES)
test -d $(WEB_DIR) && install -m 644 $(WEB_FILES) $(WEB_DIR)
board.pcb: board.sch board.prj
gsch2pcb board.prj
pcb-front.png: board.pcb
pcb -x png --dpi 150 --photo-mode board.pcb \
&& mv board.png $@
pcb-back.png: board.pcb
pcb -x png --dpi 150 --photo-mode --photo-flip-x board.pcb \
&& mv board.png $@
schematics.png: board.sch
gschem -s image.scm board.sch -o schematics.png
handlebar-big.png: handlebar.sch
gschem -s image.scm handlebar.sch -o handlebar-big.png
handlebar.png: handlebar-big.png
convert -crop 450x300+320+170 handlebar-big.png handlebar.png
gerber: $(GERBER_FILES)
$(GERBER_FILES): board.pcb
pcb -x gerber board.pcb
fab: $(GERBER_FILES)
@sh -c 'D=board-`date +\%Y\%m\%d-\%H\%M` && mkdir $$D && \
cp board.top.gbr $$D/board.gtl && \
cp board.bottom.gbr $$D/board.gbl && \
cp board.topmask.gbr $$D/board.gts && \
cp board.bottommask.gbr $$D/board.gbs && \
cp board.topsilk.gbr $$D/board.gto && \
cp board.bottomsilk.gbr $$D/board.gbo && \
cp board.outline.gbr $$D/board.gko && \
cp board.plated-drill.cnc $$D/board.txt && \
zip -r $$D.zip $$D && \
echo "Done. Output in $$D.zip."; \
echo "You may also want to do git tag gerber-fab-$$D" '
.PHONY: gerber