├── Haskell.makefile ├── README.md └── Rust.makefile /Haskell.makefile: -------------------------------------------------------------------------------- 1 | package = your-package-name 2 | 3 | stack_yaml = STACK_YAML="stack.yaml" 4 | stack = $(stack_yaml) stack 5 | 6 | build: 7 | $(stack) build $(package) 8 | 9 | build-dirty: 10 | $(stack) build --ghc-options=-fforce-recomp $(package) 11 | 12 | build-profile: 13 | $(stack) --work-dir .stack-work-profiling --profile build 14 | 15 | run: 16 | $(stack) build --fast && $(stack) exec -- $(package) 17 | 18 | install: 19 | $(stack) install 20 | 21 | ghci: 22 | $(stack) ghci $(package):lib --ghci-options='-j6 +RTS -A128m' 23 | 24 | test: 25 | $(stack) test $(package) 26 | 27 | test-ghci: 28 | $(stack) ghci $(package):test:$(package)-tests --ghci-options='-j6 +RTS -A128m' 29 | 30 | bench: 31 | $(stack) bench $(package) 32 | 33 | ghcid: 34 | $(stack) exec -- ghcid -c "stack ghci $(package):lib --test --ghci-options='-fobject-code -fno-warn-unused-do-bind -j4 +RTS -A128m' --main-is $(package):$(package)" 35 | 36 | dev-deps: 37 | stack install ghcid 38 | 39 | .PHONY : build build-dirty run install ghci test test-ghci ghcid dev-deps 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # makefiles 2 | 3 | This a repository of reusable Makefiles derived from projects I work on. Note that I use Makefiles like a command dispatcher, not how it's intended to be used. 4 | 5 | ## Fetching 6 | 7 | To fetch .gitignore files from github/gitignore and Makefiles from this repository, I use another project of mine, [lefortovo](https://github.com/bitemyapp/lefortovo). 8 | -------------------------------------------------------------------------------- /Rust.makefile: -------------------------------------------------------------------------------- 1 | package = your-package-name 2 | 3 | env = OPENSSL_INCLUDE_DIR="/usr/local/opt/openssl/include" 4 | cargo = $(env) cargo 5 | debug-env = RUST_BACKTRACE=1 RUST_LOG=$(package)=debug 6 | debug-cargo = $(env) $(debug-env) cargo 7 | 8 | build: 9 | $(cargo) build 10 | 11 | build-release: 12 | $(cargo) build --release 13 | 14 | clippy: 15 | $(cargo) clippy 16 | 17 | run: build 18 | ./target/debug/$(package) 19 | 20 | install: 21 | $(cargo) install --force 22 | 23 | test: 24 | $(cargo) test 25 | 26 | test-debug: 27 | $(debug-cargo) test -- --nocapture 28 | 29 | fmt: 30 | $(cargo) fmt 31 | 32 | watch: 33 | $(cargo) watch 34 | 35 | # You need nightly for rustfmt at the moment 36 | dev-deps: 37 | $(cargo) install fmt 38 | $(cargo) install clippy 39 | $(cargo) install rustfmt-nightly 40 | 41 | .PHONY : build build-release run install test test-debug fmt watch dev-deps 42 | --------------------------------------------------------------------------------