Skip to content

Instantly share code, notes, and snippets.

@NichtJens
Forked from mzabaluev/Makefile.cargo
Last active March 24, 2019 15:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NichtJens/56b23ae3236672e8ef2e5c6c4d97c9c2 to your computer and use it in GitHub Desktop.
Save NichtJens/56b23ae3236672e8ef2e5c6c4d97c9c2 to your computer and use it in GitHub Desktop.
Drop-in makefile for Cargo projects
CARGO = cargo
all: build doc
build:
@$(CARGO) build
doc:
@$(CARGO) doc
check: build test
test:
@$(CARGO) test
bench:
@$(CARGO) bench
clean:
@$(CARGO) clean
.PHONY: all build doc check test bench clean
@NichtJens
Copy link
Author

Shortened compared to the original:

  • turned internal calls to $(MAKE) into prerequisites/dependences
  • dropped CARGO_OPTS as cargo does not have any switch that would work at this position*

*calls have the forms

    cargo <command> [<args>...]
    cargo [options]

where only the first is relevant here, which does not allow [options] in front of <command>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment