A Makefile for KiCad 7.0+ projects. It leverages the new kicad-cli
command included in 7.0 to generate output data for distribution and production.
- Clone this repository somewhere and define an environment variable
KICADMK_DIR
to the folder:export KICADMK_DIR=/home/me/kicad-makefile
- Copy the example Makefile 'Makefile.example' to the KiCad project to build:
cp Makefile.example /home/me/my_project/Makefile
- Edit the example Makefile referring to comments as a guide.
- Run
make
to run default target that builds output, a merged sch and pcb .pdf and a distribution and production .zip:
- ./output/my_project.pdf: merged pdf with sch pages and pcb copper layers.
- ./output/dist/my_project.zip: sch renders, pcb renders, bom, gerbers, pos and drill files.
- ./output/prod/my_project-prod.zip: bom, gerbers, pos and drill files.
Refer to 'Kicad.mk' for other targets.
The project is alpha status and also consider that the kicad-cli
command is at an early stage; things might change!
- BoM: KiBOM by default, requires install either with
pip
or path to repository - see Makefile.example and './bin/kibom'. Can be defined withBOM_CMD
andBOM_CMD_FLAGS
. Note that by default, the KiBOM script appends to target output so will be re-built wheneverBOM_FILE
is a prerequisite. One can fix this by supplying a 'bom.ini' withoutput_file_name = %O
.
A target to build a docker container is available make image
. One can then run make within the KiCad project folder with:
docker run --rm -v "$(pwd)":/project kicad-makefile:latest make
The project also publish a package:
docker pull ghcr.io/tuna-f1sh/kicad-makefile:latest
See my entree project as an example of how to use this to build outputs for release etc.
Defaults shown, can be set in Makefile or environment. Refer to Makefile.example for others.
# Main output folder for generated files
OUTPUT_FOLDER ?= $(PROJECT_ROOT)/output
# Dist sub-folders
DIST_FOLDER ?= $(OUTPUT_FOLDER)/dist
PROD_FOLDER ?= $(OUTPUT_FOLDER)/prod