Switch to common build infrastructure
authorKeith Packard <keithp@keithp.com>
Fri, 15 Jul 2016 20:01:44 +0000 (13:01 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 15 Jul 2016 20:01:44 +0000 (13:01 -0700)
Signed-off-by: Keith Packard <keithp@keithp.com>
Makefile
attribs
gnet-partslist-bom.scm [deleted file]
gnet-partslist-csv.scm [deleted file]
gnet-partslist-keithp.scm [deleted file]

index 7747d93cc22171705cfb595c780900e940c5eb02..256ab2a9337162ad4d26cd76be08633dcd23744f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,95 +1,13 @@
+# name of project, also used for PCB file
 PROJECT=telefire
-AM=../altusmetrum
-SCHEME=$(AM)/scheme
-NICKLE=$(AM)/nickle
-RETAB=nickle $(NICKLE)/retab
 
-# intentionally want to rebuild drc and bom on every invocation
-all:   drc pcb partslist partslist.csv partslist.dk zip
+# list of schematic files that make up this design
+SCHEMATICS=telefire.sch
 
-drc:   $(PROJECT).sch Makefile
-       -gnetlist -g drc2 $(PROJECT).sch -o $(PROJECT).drc
+# number of PCB layers
+LAYERS=4
 
-partslist: $(PROJECT).sch
-       gnetlist -L $(SCHEME) -g bom -o $(PROJECT).tabtmp $(PROJECT).sch
-       (head -n1 $(PROJECT).tabtmp; tail -n+2 $(PROJECT).tabtmp | sort) | $(RETAB) > $@ && rm -f $(PROJECT).tabtmp
-
-partslist.csv: $(PROJECT).sch Makefile
-       gnetlist -L $(SCHEME) -g partslistgag -o $(PROJECT).csvtmp $(PROJECT).sch
-       (head -n1 $(PROJECT).csvtmp; tail -n+2 $(PROJECT).csvtmp | sort -t \, -k 8) > $@ && rm -f $(PROJECT).csvtmp
-
-partslist.dk: $(PROJECT).sch Makefile $(SCHEME)/gnet-partslist-bom.scm
-       gnetlist -L $(SCHEME) -g partslist-bom -Ovendor=digikey -o $@ $(PROJECT).sch
-
-partslist.mouser: $(PROJECT).sch Makefile $(SCHEME)/gnet-partslist-bom.scm
-       gnetlist -L $(SCHEME) -g partslist-bom -Ovendor=mouser -o $@ $(PROJECT).sch
-
-muffin-5267.pdf: partslist.csv $(AM)/glabels/muffin-5267.glabels
-       glabels-3-batch $(AM)/glabels/muffin-5267.glabels -i partslist.csv -o muffin-5267.ps && ps2pdf muffin-5267.ps && rm muffin-5267.ps
-pcb:   $(PROJECT).sch project Makefile
-       gsch2pcb project
-
-telefire.pcb: pcb
-
-# note that 'gschlas -e foo.sch' will embed all symbols in the schematic, this
-# might be a really good idea for publishing designs to the web that others
-# might review?  Like this example from DJ:
-#
-#web :
-#        for i in channel.sch ethernet.sch power.sch mcu.sch; do \
-#          cp $$i tmp.sch ; \
-#          gschlas -e tmp.sch ; \
-#          mv tmp.sch ${WEB}/$$i; \
-#        done
-
-# this shoves local work out to the git.gag.com repository
-push:  
-       git push --mirror
-
-$(PROJECT).xy: $(PROJECT).pcb
-       pcb -x bom $(PROJECT).pcb
-
-$(PROJECT).gerb: $(PROJECT).pcb
-       rm -f *.gbr *.cnc
-       pcb -x gerber $(PROJECT).pcb
-       touch $@
-
-PDF=$(PROJECT)-sch.pdf $(PROJECT)-pcb.pdf 50cal.pdf
-
-PS=$(PROJECT)-sch.ps $(PROJECT)-pcb.ps
-
-pdf: $(PDF)
-
-$(PROJECT)-sch.pdf: $(PROJECT)-sch.ps
-       ps2pdf $(PROJECT)-sch.ps
-
-$(PROJECT)-pcb.pdf: $(PROJECT)-pcb.ps
-       ps2pdf $(PROJECT)-pcb.ps
-
-$(PROJECT)-sch.ps: $(PROJECT).sch
-       gschem -p -o $@ -s /usr/share/gEDA/scheme/print.scm  $(PROJECT).sch
-
-$(PROJECT)-pcb.ps: $(PROJECT).pcb
-       pcb -x ps --ps-color --psfile $(PROJECT)-pcb.ps --media Letter $(PROJECT).pcb
-
-zip: $(PROJECT).zip $(PROJECT)-stencil.zip
-
-$(PROJECT).zip: $(PROJECT).gerb $(PROJECT).xy
-       rm -f $(PROJECT).zip
-       zip $(PROJECT).zip *.gbr *.cnc *.xy
-
-$(PROJECT)-stencil.zip: $(PROJECT).gerb
-       rm -f $(PROJECT)-stencil.zip
-       zip $(PROJECT)-stencil.zip $(PROJECT).toppaste.gbr $(PROJECT).outline.gbr
-
-50cal.pdf: 50cal.ps
-       ps2pdf 50cal.ps
-
-50cal.ps: 50cal.pcb
-       pcb -x ps --ps-color --psfile $@ --media Letter 50cal.pcb
-
-clean:
-       rm -f *.bom *.drc *.log *~ $(PROJECT).ps *.gbr $(PROJECT).gerb *.cnc *bak* *- *.zip 
-       rm -f *.net *.xy *.cmd *.png partslist partslist.csv
-       rm -f *.partslist *.new.pcb *.unsorted $(PROJECT).xls
+# sides with silkscreen, can be none|top|bottom|both
+SILK=both
 
+include ../altusmetrum/pcb.mk
diff --git a/attribs b/attribs
index 92a91e75677fda2f70a5870ff18b6441bd146af9..d7af178679184d8c3bf877499266e2bdbee31cb5 100644 (file)
--- a/attribs
+++ b/attribs
@@ -1,6 +1,8 @@
+device
 value
-vendor
-vendor_part_number
 footprint
 loadstatus
-device
+provided
+mfg_part_number
+vendor
+vendor_part_number
diff --git a/gnet-partslist-bom.scm b/gnet-partslist-bom.scm
deleted file mode 100644 (file)
index 8d2c73e..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-; Copyright © 2012 Keith Packard <keithp@keithp.com>
-; gnet-partslist-bom.scm
-; 
-; This program is free software; you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or
-; (at your option) any later version.
-; 
-; This program is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.
-; 
-; You should have received a copy of the GNU General Public License
-; along with this program; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-; The /'s may not work on win32
-(load (string-append gedadata "/scheme/gnet-partslist-common.scm"))
-
-(define (caddddddr s)
-  (car (cdr (cdr (cdr (cdr (cdr (cdr s))))))))
-
-(define (cadddddr s)
-  (car (cdr (cdr (cdr (cdr (cdr s)))))))
-
-(define (caddddr s)
-  (car (cdr (cdr (cdr (cdr s))))))
-
-(define (partslist-bom:write-part s port)
-  (let ((quantity (caddddddr s))
-       (part (cadddddr s))
-       (device (cadr s))
-       (value (caddr s)))
-    (display quantity port)
-    (display ", " port)
-    (display part port)
-    (display ", " port)
-    (display device port)
-    (display " " port)
-    (display value port)
-    (display "\n" port)))
-
-(define (partslist-bom:write-partslist ls port)
-  (if (null? ls)
-      '()
-      (begin (partslist-bom:write-part (car ls) port)
-            (partslist-bom:write-partslist (cdr ls) port))))
-
-(define (count-same-parts ls)
-  (if (null? ls)
-      (append ls)
-      (let* ((parts-table-no-uref (let ((result '()))
-                                   (for-each (lambda (l) (set! result (cons (cdr l) result))) (reverse ls))
-                                   (append result)))
-            (first-ls (car parts-table-no-uref))
-            (match-length (length (member first-ls (reverse parts-table-no-uref))))
-            (rest-ls (list-tail ls match-length))
-            (match-ls (list-tail (reverse ls) (- (length ls) match-length)))
-            (uref-ls (let ((result '()))
-                       (for-each (lambda (l) (set! result (cons (car l) result))) match-ls)
-                       (append result))))
-       (cons (cons uref-ls (append first-ls  (list match-length))) (count-same-parts rest-ls)))))
-
-(define get-vendor
-   (lambda (package)
-      (gnetlist:get-package-attribute package "vendor")))
-
-(define get-vendor-part-number
-   (lambda (package)
-      (gnetlist:get-package-attribute package "vendor_part_number")))
-
-(define get-footprint
-   (lambda (package)
-      (gnetlist:get-package-attribute package "footprint")))
-
-(define (get-parts-table-bom packages vendor)
-  (if (null? packages)
-      '()
-      (let ((package (car packages)))
-       (if (string=? (get-vendor package) vendor)
-           (if (string=? (get-device package) "include")
-               (get-parts-table-bom (cdr packages) vendor)
-               (cons (list package
-                           (get-device package)
-                           (get-value package)
-                           (get-footprint package)
-                           (get-vendor package)
-                           (get-vendor-part-number package)) ;; sdb change
-                     (get-parts-table-bom (cdr packages) vendor)))
-           (get-parts-table-bom (cdr packages) vendor)))))
-           
-
-(define (get-vendor-match)
-  (let ((vendor-param (calling-flag? "vendor" (gnetlist:get-calling-flags))))
-    (if vendor-param
-       (cdr vendor-param)
-       "digikey")))
-
-(define (partslist-bom output-filename)
-  (let ((port (open-output-file output-filename))
-       (parts-table (marge-sort-with-multikey (get-parts-table-bom packages (get-vendor-match)) '(1 2 3 0))))
-    (set! parts-table (count-same-parts parts-table))
-    (partslist-bom:write-partslist parts-table port)
-    (close-output-port port)))
diff --git a/gnet-partslist-csv.scm b/gnet-partslist-csv.scm
deleted file mode 100644 (file)
index 0f735f7..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-; Copyright (C) 2001-2010 MIYAMOTO Takanori
-; gnet-partslist-csv.scm
-; 
-; This program is free software; you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or
-; (at your option) any later version.
-; 
-; This program is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.
-; 
-; You should have received a copy of the GNU General Public License
-; along with this program; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-; The /'s may not work on win32
-(load (string-append gedadata "/scheme/gnet-partslist-common.scm"))
-
-(define partslist-csv:write-top-header
-  (lambda (port)
-    (display "device, value, footprint, vendor, vendor_part_number, quantity, refdes\n" port)))
-
-(define (partslist-csv:write-partslist ls port)
-  (if (null? ls)
-      '()
-      (begin (write-one-row (cdar ls) ", " ", " port)
-            (write-one-row (caar ls) " " "\n" port)
-            (partslist-csv:write-partslist (cdr ls) port))))
-
-(define (count-same-parts ls)
-  (if (null? ls)
-      (append ls)
-      (let* ((parts-table-no-uref (let ((result '()))
-                                   (for-each (lambda (l) (set! result (cons (cdr l) result))) (reverse ls))
-                                   (append result)))
-            (first-ls (car parts-table-no-uref))
-            (match-length (length (member first-ls (reverse parts-table-no-uref))))
-            (rest-ls (list-tail ls match-length))
-            (match-ls (list-tail (reverse ls) (- (length ls) match-length)))
-            (uref-ls (let ((result '()))
-                       (for-each (lambda (l) (set! result (cons (car l) result))) match-ls)
-                       (append result))))
-       (cons (cons uref-ls (append first-ls  (list match-length))) (count-same-parts rest-ls)))))
-
-(define get-vendor
-   (lambda (package)
-      (gnetlist:get-package-attribute package "vendor")))
-
-(define get-vendor-part-number
-   (lambda (package)
-      (gnetlist:get-package-attribute package "vendor_part_number")))
-
-(define get-footprint
-   (lambda (package)
-      (gnetlist:get-package-attribute package "footprint")))
-
-(define get-loadstatus
-  (lambda (package)
-    (gnetlist:get-package-attribute package "loadstatus")))
-
-(define (get-parts-table-csv packages)
-  (if (null? packages)
-      '()
-      (let ((package (car packages)))
-       (if (string=? (get-device package) "include")
-           (get-parts-table-csv (cdr packages))
-           (if (string=? (get-loadstatus package) "smt")
-               (cons (list package
-                           (get-device package)
-                           (get-value package)
-                           (get-footprint package)
-                           (get-vendor package)
-                           (get-vendor-part-number package)) ;; sdb change
-                     (get-parts-table-csv (cdr packages)))
-               (get-parts-table-csv (cdr packages)))))))
-
-(define partslist-csv
-  (lambda (output-filename)
-    (let ((port (open-output-file output-filename))
-         (parts-table (marge-sort-with-multikey (get-parts-table-csv packages) '(1 2 3 0))))
-      (set! parts-table (count-same-parts parts-table))
-      (partslist-csv:write-top-header port)
-      (partslist-csv:write-partslist parts-table port)
-      (close-output-port port))))
diff --git a/gnet-partslist-keithp.scm b/gnet-partslist-keithp.scm
deleted file mode 100644 (file)
index 2d01305..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-; Copyright (C) 2001-2010 MIYAMOTO Takanori
-; gnet-partslist-keithp.scm
-; 
-; This program is free software; you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation; either version 2 of the License, or
-; (at your option) any later version.
-; 
-; This program is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; GNU General Public License for more details.
-; 
-; You should have received a copy of the GNU General Public License
-; along with this program; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-; The /'s may not work on win32
-(load (string-append gedadata "/scheme/gnet-partslist-common.scm"))
-
-(define partslist-keithp:write-top-header
-  (lambda (port)
-    (display ".START\n" port)
-    (display "..device\tvalue\tfootprint\t\tvendor\tvendor_part_number\tquantity\trefdes\n" port)))
-
-(define (partslist-keithp:write-partslist ls port)
-  (if (null? ls)
-      '()
-      (begin (write-one-row (cdar ls) "\t" "\t" port)
-            (write-one-row (caar ls) " " "\n" port)
-            (partslist-keithp:write-partslist (cdr ls) port))))
-
-(define partslist-keithp:write-bottom-footer
-  (lambda (port)
-    (display ".END" port)
-    (newline port)))
-
-(define (count-same-parts ls)
-  (if (null? ls)
-      (append ls)
-      (let* ((parts-table-no-uref (let ((result '()))
-                                   (for-each (lambda (l) (set! result (cons (cdr l) result))) (reverse ls))
-                                   (append result)))
-            (first-ls (car parts-table-no-uref))
-            (match-length (length (member first-ls (reverse parts-table-no-uref))))
-            (rest-ls (list-tail ls match-length))
-            (match-ls (list-tail (reverse ls) (- (length ls) match-length)))
-            (uref-ls (let ((result '()))
-                       (for-each (lambda (l) (set! result (cons (car l) result))) match-ls)
-                       (append result))))
-       (cons (cons uref-ls (append first-ls  (list match-length))) (count-same-parts rest-ls)))))
-
-(define get-vendor
-   (lambda (package)
-      (gnetlist:get-package-attribute package "vendor")))
-
-(define get-vendor-part-number
-   (lambda (package)
-      (gnetlist:get-package-attribute package "vendor_part_number")))
-
-(define get-footprint
-   (lambda (package)
-      (gnetlist:get-package-attribute package "footprint")))
-
-(define (get-parts-table-keithp packages)
-  (if (null? packages)
-      '()
-      (let ((package (car packages)))
-       (if (string=? (get-device package) "include")
-           (get-parts-table-keithp (cdr packages))
-           (cons (list package
-                       (get-device package)
-                       (get-value package)
-                       (get-footprint package)
-                       (get-vendor package)
-                       (get-vendor-part-number package)) ;; sdb change
-                 (get-parts-table-keithp (cdr packages)))))))
-
-(define partslist-keithp
-  (lambda (output-filename)
-    (let ((port (open-output-file output-filename))
-         (parts-table (marge-sort-with-multikey (get-parts-table-keithp packages) '(1 2 3 0))))
-      (set! parts-table (count-same-parts parts-table))
-      (partslist-keithp:write-top-header port)
-      (partslist-keithp:write-partslist parts-table port)
-      (close-output-port port))))