pashage

Yet Another Opinionated Re-engineering of the Unix Password Store
git clone https://git.instinctive.eu/pashage.git
Log | Files | Refs | README | LICENSE

Makefile (2615B)


      1 # pashage - age-backed POSIX password manager
      2 # Copyright (C) 2024-2025  Natasha Kerensikova
      3 #
      4 # This program is free software; you can redistribute it and/or
      5 # modify it under the terms of the GNU General Public License
      6 # as published by the Free Software Foundation; either version 2
      7 # of the License, or (at your option) any later version.
      8 #
      9 # This program is distributed in the hope that it will be useful,
     10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 # GNU General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License
     15 # along with this program; if not, write to the Free Software
     16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     17 
     18 PLATFORM != uname | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]'
     19 
     20 pashage: bin/pashage-$(PLATFORM).sh
     21 	cp -i "bin/pashage-$(PLATFORM).sh" "$@"
     22 	chmod a+x "$@"
     23 
     24 .PHONY: all check clean cov1 cov2 tests validate
     25 
     26 all: bin/pashage-freebsd.sh bin/pashage-openbsd.sh bin/pashage-linux.sh
     27 
     28 check: bin/pashage-$(PLATFORM).sh
     29 	shellcheck -o all "bin/pashage-$(PLATFORM).sh"
     30 
     31 clean:
     32 	rm -rf pashage bin/
     33 
     34 cov1:
     35 	shellspec --kcov -s bash \
     36 	    spec/internal_spec.sh \
     37 	    spec/scm_spec.sh \
     38 	    spec/action_spec.sh \
     39 	    spec/usage_spec.sh
     40 	grep -q '"covered":"100.0"' coverage/index.js
     41 
     42 cov2:
     43 	shellspec --kcov -s bash \
     44 	    spec/pass_spec.sh \
     45 	    spec/pashage_extra_spec.sh
     46 	grep -q '"covered":"100.0"' coverage/index.js
     47 
     48 tests:
     49 	shellspec
     50 
     51 validate: check tests cov1 cov2
     52 
     53 bin/pashage-freebsd.sh: src/platform-freebsd.sh src/pashage.sh src/run.sh
     54 	mkdir -p bin
     55 	sed '1{;x;d;};/^###########$$/{;x;q;};x' src/run.sh >|"$@"
     56 	sed '1,/^$$/d' src/platform-freebsd.sh >>"$@"
     57 	echo >>"$@"
     58 	sed '1,/^$$/d' src/pashage.sh >>"$@"
     59 	echo >>"$@"
     60 	echo '############' >>"$@"
     61 	sed '1,/^############$$/d' src/run.sh >>"$@"
     62 	chmod a+x "$@"
     63 
     64 bin/pashage-openbsd.sh: src/platform-openbsd.sh src/pashage.sh src/run.sh
     65 	mkdir -p bin
     66 	sed '1{;x;d;};/^###########$$/{;x;q;};x' src/run.sh >|"$@"
     67 	sed '1,/^$$/d' src/platform-openbsd.sh >>"$@"
     68 	echo >>"$@"
     69 	sed '1,/^$$/d' src/pashage.sh >>"$@"
     70 	echo >>"$@"
     71 	echo '############' >>"$@"
     72 	sed '1,/^############$$/d' src/run.sh >>"$@"
     73 	chmod a+x "$@"
     74 
     75 bin/pashage-linux.sh: src/platform-linux.sh src/pashage.sh src/run.sh
     76 	mkdir -p bin
     77 	sed '1{;x;d;};/^###########$$/{;x;q;};x' src/run.sh >|"$@"
     78 	sed '1,/^$$/d' src/platform-linux.sh >>"$@"
     79 	echo >>"$@"
     80 	sed '1,/^$$/d' src/pashage.sh >>"$@"
     81 	echo >>"$@"
     82 	echo '############' >>"$@"
     83 	sed '1,/^############$$/d' src/run.sh >>"$@"
     84 	chmod a+x "$@"