Created
October 10, 2020 12:28
-
-
Save playniuniu/07899fc851a73f49ae79abd6c8567f05 to your computer and use it in GitHub Desktop.
Makefile for cross compile rust
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
| BINARY=hello_cargo | |
| run: | |
| # run | |
| @cargo run | |
| linux: | |
| # build for linux | |
| @rm -f ${BINARY} | |
| @cargo build --release --target=x86_64-unknown-linux-musl | |
| @mv target/x86_64-unknown-linux-musl/release/${BINARY} . | |
| windows: | |
| # build for windows | |
| @rm -f ${BINARY}.exe | |
| @cargo build --release --target=x86_64-pc-windows-gnu | |
| @mv target/x86_64-pc-windows-gnu/release/${BINARY}.exe . | |
| @upx ${BINARY}.exe | |
| arm: | |
| # build for arm | |
| @rm -f ${BINARY} | |
| @cargo build --release --target=armv7-unknown-linux-musleabihf | |
| @mv target/armv7-unknown-linux-musleabihf/release/${BINARY} . | |
| @upx ${BINARY} | |
| clean: | |
| # clean | |
| @rm -f ${BINARY} | |
| @rm -f ${BINARY}.exe | |
| PHONY: run linux windows arm clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment