diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2daa8e6 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +# pipefail is not POSIX complaint + +# Export these variables for all commands in this Makefile +# the 'export' seems not to be necessary +$(eval isGuix := $(shell command -v guix > /dev/null 2>&1 && echo t || echo f)) +$(eval destDir := $(shell [ "${isGuix}" = t ] && echo $${dotf}/bin || echo ~/bin)) + +all: show-environment clean install-deps + [ ! -d ${destDir} ] && mkdir ${destDir} || : + raco exe -o ${destDir}/search-notes main.rkt + [ "${isGuix}" = t ] && gxhre --cores=${cores} || : + + @# both can be used: ${...} also $(...) + @# commands must be terminated by '; \' + @# @if [ "$(isGuix)" = t ]; then \ + # @# echo '# => $$isGuix: ${isGuix}; true branch'; \ + # else \ + # @# echo '# => $$isGuix: ${isGuix}; false branch'; \ + # : ; \ + # fi + +show-environment: + @echo '### => $$isGuix: ${isGuix}' + @echo '### => $$destDir: ${destDir}' + +install-deps: + @# without --skip-installed the this target fails. + raco pkg install --skip-installed --auto ansi-color + +clean: + rm -rf ./compiled/ ./scribblings/compiled/ + diff --git a/README.md b/README.md index 2212fee..4b77483 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ search-notes ============ -Installation: +Installation: run `make`. See also Makefile. ```bash # Fix the 'loading code: version mismatch' error rm -rf ./compiled/ ./scribblings/compiled/ raco pkg install --auto ansi-color -command -v guix && destDir=$dotf/bin || destDir=~/bin -[ ! -d $destDir ] && mkdir $destDir +isGuix=$(command -v guix > /dev/null 2>&1 && echo t || echo f) +[ ${isGuix} = t ] && destDir=$dotf/bin || destDir=~/bin +[ ! -d ${destDir} ] && mkdir $destDir || : raco exe -o $destDir/search-notes main.rkt -# gxhre --cores=24 +[ ${isGuix} = t ] && gxhre --cores=${cores} || : ``` See main.rkt -> command-line -> #:usage-help