]> www.fi.muni.cz Git - bike-lights.git/blobdiff - schematics/Makefile
pwm.c: channels running - visible from the outside
[bike-lights.git] / schematics / Makefile
index 0a443c9a00a9be7d076ebdb178ace28970935307..f669597c8e1df51d753ba66c4e90b91ec3550599 100644 (file)
@@ -1,11 +1,23 @@
 WEB_DIR=/home/kas/html/bike-lights/
-WEB_FILES=pcb-back.png pcb-front.png
+WEB_FILES=pcb-back.png pcb-front.png schematics.png handlebar.png
+GERBER_FILES=\
+       lights.top.gbr \
+       lights.bottom.gbr \
+       lights.topmask.gbr \
+       lights.bottommask.gbr \
+       lights.topsilk.gbr \
+       lights.bottomsilk.gbr \
+       lights.plated-drill.cnc
+
+all:
+       @echo "Usage: make [clean|web|gerber|fab|lights.pcb]"
 
 clean:
        rm -f lights.cmd lights.jpg lights.net lights.new.pcb lights.pcb- \
-               lights.png lights.ps lights.sch~ pcb-back.png pcb-front.png
+               lights.png lights.ps lights.sch~ pcb-back.png pcb-front.png \
+               schematics.png *.gbr *.cnc
 
-web: pcb-back.png pcb-front.png
+web: $(WEB_FILES)
        test -d $(WEB_DIR) && install -m 644 $(WEB_FILES) $(WEB_DIR)
 
 lights.pcb: lights.sch lights.prj
@@ -18,3 +30,32 @@ pcb-front.png: lights.pcb
 pcb-back.png: lights.pcb
        pcb -x png --dpi 150 --photo-mode --photo-flip-x lights.pcb \
                && mv lights.png $@
+
+schematics.png: lights.sch
+       gschem -s image.scm lights.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): lights.pcb
+       pcb -x gerber lights.pcb
+
+fab: $(GERBER_FILES)
+       @sh -c 'D=bike-lights-`date +\%Y\%m\%d-\%H\%M` && mkdir $$D && \
+               cp lights.top.gbr $$D/bike-lights.gtl && \
+               cp lights.bottom.gbr $$D/bike-lights.gbl && \
+               cp lights.topmask.gbr $$D/bike-lights.gts && \
+               cp lights.bottommask.gbr $$D/bike-lights.gbs && \
+               cp lights.topsilk.gbr $$D/bike-lights.gto && \
+               cp lights.bottomsilk.gbr $$D/bike-lights.gbo && \
+               cp lights.plated-drill.cnc $$D/bike-lights.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