diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-06-12 22:00:43 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-06-12 22:01:10 -0400 |
commit | fc607a39d8620b03001d353de4071cf65316b2dc (patch) | |
tree | e6cda4448912ed3b03cb7b8bd8d4f48477ca743f /Makefile | |
parent | dd600a1852e57a7a7297e573891a6e4aa5805d6c (diff) | |
download | exuberant-hacks-fc607a39d8620b03001d353de4071cf65316b2dc.tar.gz exuberant-hacks-fc607a39d8620b03001d353de4071cf65316b2dc.zip |
add a Makefile (for installation)
Probably shouldn't have the inline 'sudo', but because of how rustup works I
think most users won't have `cargo` on their root paths, so `sudo make install`
won't work.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0cb65a1 --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +# This Makefile wraps Rust's cargo build tool. +# It's mostly here for the `install` command. +# +# This Makefile is self-documenting (via the 'help' target) +# see: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html + +CARGO = cargo +CARGO_OPTS = +PREFIX=/usr + +HACKS=exuberantbovines +INSTALL_BIN=$(PREFIX)/lib/xscreensaver +INSTALL_CONFIG=$(PREFIX)/share/xscreensaver/config +INSTALL_MAN=$(PREFIX)/share/man + +all: ## Alias for build + $(MAKE) build + $(MAKE) doc + +build: ## Compiles the default target + $(CARGO) $(CARGO_OPTS) build + +build-debug: ## Compiles for 'debug' target + $(CARGO) $(CARGO_OPTS) build --debug + +build-release: ## Compiles for 'release' target + $(CARGO) $(CARGO_OPTS) build --release + +install: build-release doc-release ## Installs everything! + @echo "Installing under $(PREFIX)..." + sudo mkdir -p $(PREFIX)/lib/xscreensaver + sudo mkdir -p $(PREFIX)/share/xscreensaver/config + @for PROG in $(HACKS); do \ + sudo install -m 0755 target/release/$$PROG $(INSTALL_BIN); \ + sudo install -m 0644 extra/$$PROG.xml $(INSTALL_CONFIG); \ + done + @echo "IMPORTANT: For the hacks to show up you'll need to add the following lines to ~/.xscreensaver:" + @echo ""; + @for PROG in $(HACKS); do \ + echo "\tGL: $$PROG --root \\\\n\\\\ "; \ + done + @echo ""; + @echo "(don't worry about duplicate lines, xscreensaver will clean that up)" + +clean: ## Deletes intermediate files (including compiled deps) + $(CARGO) $(CARGO_OPTS) clean + +check: ## Rebuilds and runs tests + $(MAKE) build + $(MAKE) test + +test: ## Runs tests (if they exist) + $(CARGO) $(CARGO_OPTS) test + +bench: ## Run benchmarks (if they exist) + $(CARGO) $(CARGO_OPTS) bench + +doc: ## Builds documentation (if there is any) for the default target + $(CARGO) $(CARGO_OPTS) doc --no-deps + +doc-release: ## Builds documentation (if there is any) for release + $(CARGO) $(CARGO_OPTS) doc --no-deps --release + +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}' + +.PHONY: all build build-debug build-release clean install check test bench doc doc-release help +.DEFAULT_GOAL := all |