From 6a30e674117c02a54307b1fe8c7f1cc16da06e23 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Fri, 3 Jun 2016 22:14:09 -0400 Subject: [PATCH 1/2] Adds a Makefile for building modules One can now type: ``` $> make ``` Which builds all the modules and places them in a `out/` directory of the project root for easy finding. Alternatively one can type: ``` $> make $module ``` Where `$module` is one of the `imag-$module` names, such as `counter`, `link`, etc. To clean up the `out/` directory it's `$> make clean` --- Makefile | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 24 ++++++++++++------------ 2 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..22ab3133 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +toml = imag-$@/Cargo.toml +bin = imag-$@/target/debug/imag-$@ + +default: all + +.PHONY: clean + +all: counter link notes store tag view + +counter: prep + cargo build --manifest-path $(toml) + cp $(bin) out/ + +link: prep + cargo build --manifest-path $(toml) + cp $(bin) out/ + +notes: prep + cargo build --manifest-path $(toml) + cp $(bin) out/ + +store: prep + cargo build --manifest-path $(toml) + cp $(bin) out/ + +tag: prep + cargo build --manifest-path $(toml) + cp $(bin) out/ + +view: prep + cargo build --manifest-path $(toml) + cp $(bin) out/ + +prep: + mkdir -p out/ + +clean: + rm -rf out/ diff --git a/README.md b/README.md index 351d39a0..449477aa 100644 --- a/README.md +++ b/README.md @@ -89,26 +89,26 @@ provided (as the libraries are work-in-progress). ### Building -To build a single module: +One can build all the modules simply by running `make` which defaults to building all the modules +and placing them in the `out/` directory of the project root. + ``` -$> cd /imag- -$> cargo build -``` -It may be tiresome to build all the modules by hand, but one can do something -like this: -``` -$> for dir in \ ->$(find ./ -maxdepth 1 -path "./imag-*" -name "imag-*" -type d) ->do ->pushd $dir; cargo build; popd ->done +$> make + ... +$> ls out/ +imag-counter imag-link imag-notes imag-store imag-tag imag-view ``` +Building all the modules may take some time, so alternatively one can build only a specific module +by runing `$> make $module` where `$module` is one of the `imag-$module` names, such as `counter`, +`link`, etc. + ### Running To run imag, simply call `./bin/imag`. This script has a function to search for modules, which utilizes an environment variable called `IMAG_IS_THE_SHIT`. To run imag with all components: + ``` $> IMAG_IS_THE_SHIT=$(pwd) ./bin/imag ``` From f0dcfb1f4bfcdbdddf9a022aa657ba132091e3e1 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Sat, 4 Jun 2016 07:58:09 -0400 Subject: [PATCH 2/2] Deduplicates the Makefile --- Makefile | 28 ++++------------------------ README.md | 4 ++-- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 22ab3133..7e587fb9 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,13 @@ -toml = imag-$@/Cargo.toml -bin = imag-$@/target/debug/imag-$@ +toml = $@/Cargo.toml +bin = $@/target/debug/$@ default: all .PHONY: clean -all: counter link notes store tag view +all: imag-counter imag-link imag-notes imag-store imag-tag imag-view -counter: prep - cargo build --manifest-path $(toml) - cp $(bin) out/ - -link: prep - cargo build --manifest-path $(toml) - cp $(bin) out/ - -notes: prep - cargo build --manifest-path $(toml) - cp $(bin) out/ - -store: prep - cargo build --manifest-path $(toml) - cp $(bin) out/ - -tag: prep - cargo build --manifest-path $(toml) - cp $(bin) out/ - -view: prep +imag-%: prep cargo build --manifest-path $(toml) cp $(bin) out/ diff --git a/README.md b/README.md index 449477aa..09ff37dd 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,8 @@ imag-counter imag-link imag-notes imag-store imag-tag imag-view ``` Building all the modules may take some time, so alternatively one can build only a specific module -by runing `$> make $module` where `$module` is one of the `imag-$module` names, such as `counter`, -`link`, etc. +by runing `$> make $module` where `$module` is one of the `imag-*` names, such as `imag-counter`, +`imag-link`, etc. ### Running