Created
June 25, 2017 00:51
-
-
Save kmtr/d28e28eac9d0b54ddbd0dbaaecee7267 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using docker https://github.com/Ragnaroek/rust-on-raspberry-docker | |
# | |
# requirement | |
# - cargo (this Makefile for a cargo project) | |
# - docker | |
# - jq (for getting metadata of a project) | |
# - scp (for deploying) | |
IMAGE_VERSION=1.18.0 | |
PROJECT_NAME = $(shell cargo metadata --format-version=1 --no-deps | jq -r .packages[0].name) | |
PI_DOMAIN = pi3 | |
TARGET_DIR = arm-unknown-linux-gnueabihf | |
.PHONY: default | |
default: | |
@echo [project-name] $(PROJECT_NAME) | |
@echo [docker-image] ragnaroek/rust-raspberry:$(IMAGE_VERSION) | |
deb-deps: | |
mkdir deb-deps | |
.PHONY: cargo-build-pi | |
cargo-build-pi: deb-deps | |
docker run \ | |
--volume $(CURDIR):/home/cross/project \ | |
--volume $(CURDIR)/deb-deps:/home/cross/deb-deps \ | |
--volume ~/.cargo/registry:/home/cross/.cargo/registry \ | |
ragnaroek/rust-raspberry:$(IMAGE_VERSION) \ | |
build --release | |
.PHONY: deploy-to-pi | |
deploy-to-pi: | |
scp target/$(TARGET_DIR)/release/$(PROJECT_NAME) $(PI_DOMAIN):~/$(PROJECT_NAME) | |
.PHONY: docker-pull | |
docker-pull: | |
docker pull ragnaroek/rust-raspberry:$(IMAGE_VERSION) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment