modd.conf {}

alpine/Dockerfile {
  prep: docker build -t dkl-initrd alpine
  prep: docker run --rm dkl-initrd | base64 -d >dist/base-initrd
}

buildenv/Dockerfile {
  prep: docker build -t dkl-initrd-build buildenv
}

go.??? **/*.go {
  prep: go test ./...
  prep: mkdir -p dist
  prep: go build -o dist/ ./tools/...

  prep: mkdir -p tmp/go tmp/.cache
  prep: docker run --rm -v novit-go:/go -e GOCACHE=/go/.cache -v $PWD:/src -u $(id -u):$(id -g) dkl-initrd-build go build -o dist/init .
}

dist/init dist/base-initrd {
  prep: cd dist && ../dist/cpiocat init <base-initrd >initrd.new
  prep: mv dist/initrd.new dist/initrd
}
