From 880292fa7b8067e96af60aa7aad8a2e94ec64652 Mon Sep 17 00:00:00 2001 From: Rostislav Svoboda Date: Thu, 26 Oct 2023 15:53:30 +0200 Subject: [PATCH] Add Makefile, README: installation instructions as in the Makefile --- Makefile | 32 ++++++++++++++++++++++++++++++++ README.md | 9 +++++---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 Makefile 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