ee = {{ ee }} report_dir = {{ project.report_dir }} {%- if sch is defined %} sch = {{ sch | ninja_path }} sch_files = {{ sch_files | ninja_path }} {%- endif %} {%- if pcb is defined %} pcb = {{ pcb | ninja_path }} {%- endif %} rule kicad-gerber description = kicad-gerber command = $ee kicad-gerber $ --output-dir $gerber_dir $ --pcb $pcb # mkdir -p $( # (cd $(GERBER_DIR); zip tmp.zip $(foreach GBR,$(GERBERS),$(notdir $(GBR)))) # mv $(GERBER_DIR)/tmp.zip $@ rule kicad-make-bom description = kicad-make-bom $out command = $ee kicad-make-bom --sch $sch --out $out rule pn-part-search-list description = pn-part-search-list supplier: $supplier command = $ee pn-part-search-list --in $in --out $out --supplier $supplier rule part-apply-function command = $ee part-apply-function --execution $execution --in $in --out $out $functions $arguments rule part-find-requirements description = part-find-requirements command = $ee part-find-requirements --in $in --out $out rule part-validate-parts command = $ee part-validate-parts --in $in --out $out rule digikey-search-parts description = digikey-search-parts command = $ee digikey-search-parts --in $in --out $out rule element14-search-parts description = element14-search-parts command = $ee element14-search-parts --in $in --out $out rule create-bom description = create-bom command = $ee create-bom --schematic $schematic --part-db $part_dbs --out $out $strategy rule split-parts-by-supplier description = split-parts-by-supplier command = $ee split-parts-by-supplier --parts $order $part_dbs --out-dir $out_dir rule import-parts-yaml description = import-parts-yaml $in command = $ee import-parts-yaml --in $in --out $out rule drawio-decompress command = $ee drawio-decompress --in $in --out $out rule drawio-to-parts command = $ee drawio-to-parts --in $in --out $out $args rule part-from-excel command = $ee part-from-excel --in $in --out $out --sheet "$sheet" {% if gerber_zip is defined %} build gerbers: phony {{ gerber_zip }} build {{ gerber_zip }}: kicad-gerber $pcb gerber_dir = {{ gerber_zip | parent_dir }} {%- endif %} {% if sch is defined -%} build ee/kicad-sch.xml: kicad-make-bom $sch build ee/sch.xml: part-apply-function ee/kicad-sch.xml execution = kicad {%- if project.cfg["kicad-project"]["functions"] %} functions = --function {{ project.cfg["kicad-project"]["functions"] }} {%- else %} functions = --function ee.kicad.functions.default {%- endif %} {%- if project.cfg["kicad-project"]["function-arguments"] %} arguments = --argument {{ project.cfg["kicad-project"]["function-arguments"] }} {%- else %} arguments = {%- endif %} {%- endif %} build $report_dir/part-validate-parts.rst: part-validate-parts ee/sch.xml build ee/requirements.xml: part-find-requirements ee/sch.xml {% for s in distributors %} {%- set cfg = project.cfg["supplier:" + s] if "supplier:" + s in project.cfg else None %} # Supplier {{ s }} build ee/{{ s }}/pn-part-search-list.xml: pn-part-search-list ee/sch.xml supplier = {{ s }} build ee/{{ s }}/downloaded.xml | ee/{{ s }}/downloaded.rst: {{ s }}-search-parts ee/{{ s }}/pn-part-search-list.xml build ee/{{ s }}/parts.xml: part-apply-function ee/{{ s }}/downloaded.xml execution = {{ s }} {%- if cfg and "functions" in cfg %} functions = --function {{ cfg["functions"] }} {%- else %} functions = --function ee.{{ s }}.functions.default {%- endif %} {%- if cfg and "function-arguments" in cfg %} arguments = --argument {{ cfg["function-arguments"] }} {%- endif %} {%- endfor %} {%- for f in parts_yaml_files %} {% set out=(f | parent_dir) / ((f | noext) + ".xml") %} build {{ out }}: import-parts-yaml {{ f }} # default {{ out }} {% endfor %} build ee/bom.xml | $report_dir/bom.rst: create-bom ee/sch.xml {%- for p in part_dbs %} {{ p }}.xml{% endfor %} schematic = ee/sch.xml part_dbs ={%- for p in part_dbs %} {{ p }}.xml{% endfor %} {%- if project.cfg["create-bom"] and project.cfg["create-bom"]["strategy"] %} strategy = --strategy {{ project.cfg["create-bom"]["strategy"] }} {%- endif %} build ee/orders/index.xml: split-parts-by-supplier ee/bom.xml {%- for p in part_dbs %} {{ p }}.xml{% endfor %} order = ee/bom.xml part_dbs ={%- for p in part_dbs %} --part-db {{ p }}.xml{% endfor %} out_dir = ee/orders default ee/orders/index.xml rule seeed-download-opl description = seeed-download-opl $opl command = $ee seeed-download-opl --out $out --opl $opl {% if project.cfg.has_section("seeed-opl") %} {%- set opls=project.cfg["seeed-opl"]["opls"].split(",") -%} build seeed-download-opls: phony{%- for opl in opls %} ee/seeed/opl/{{ opl.strip() }}.xml{% endfor %} {%- for opl in opls %} {% set opl=opl.strip() -%} build ee/seeed/opl/{{ opl }}.xml: seeed-download-opl opl = {{ opl }} {% endfor -%} {% endif -%}