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 (2594B)


      1 # pashage - age-backed POSIX password manager
      2 # Copyright (C) 2024  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 
     23 .PHONY: all check clean cov1 cov2 tests validate
     24 
     25 all: bin/pashage-freebsd.sh bin/pashage-openbsd.sh bin/pashage-linux.sh
     26 
     27 check: bin/pashage-$(PLATFORM).sh
     28 	shellcheck -o all "bin/pashage-$(PLATFORM).sh"
     29 
     30 clean:
     31 	rm -rf pashage bin/
     32 
     33 cov1:
     34 	shellspec --kcov -s bash \
     35 	    spec/internal_spec.sh \
     36 	    spec/scm_spec.sh \
     37 	    spec/action_spec.sh \
     38 	    spec/usage_spec.sh
     39 	grep -q '"covered":"100.0"' coverage/index.js
     40 
     41 cov2:
     42 	shellspec --kcov -s bash \
     43 	    spec/pass_spec.sh \
     44 	    spec/pashage_extra_spec.sh
     45 	grep -q '"covered":"100.0"' coverage/index.js
     46 
     47 tests:
     48 	shellspec
     49 
     50 validate: check tests cov1 cov2
     51 
     52 bin/pashage-freebsd.sh: src/platform-freebsd.sh src/pashage.sh src/run.sh
     53 	mkdir -p bin
     54 	sed '1{;x;d;};/^###########$$/{;x;q;};x' src/run.sh >|"$@"
     55 	sed '1,/^$$/d' src/platform-freebsd.sh >>"$@"
     56 	echo >>"$@"
     57 	sed '1,/^$$/d' src/pashage.sh >>"$@"
     58 	echo >>"$@"
     59 	echo '############' >>"$@"
     60 	sed '1,/^############$$/d' src/run.sh >>"$@"
     61 	chmod a+x "$@"
     62 
     63 bin/pashage-openbsd.sh: src/platform-openbsd.sh src/pashage.sh src/run.sh
     64 	mkdir -p bin
     65 	sed '1{;x;d;};/^###########$$/{;x;q;};x' src/run.sh >|"$@"
     66 	sed '1,/^$$/d' src/platform-openbsd.sh >>"$@"
     67 	echo >>"$@"
     68 	sed '1,/^$$/d' src/pashage.sh >>"$@"
     69 	echo >>"$@"
     70 	echo '############' >>"$@"
     71 	sed '1,/^############$$/d' src/run.sh >>"$@"
     72 	chmod a+x "$@"
     73 
     74 bin/pashage-linux.sh: src/platform-linux.sh src/pashage.sh src/run.sh
     75 	mkdir -p bin
     76 	sed '1{;x;d;};/^###########$$/{;x;q;};x' src/run.sh >|"$@"
     77 	sed '1,/^$$/d' src/platform-linux.sh >>"$@"
     78 	echo >>"$@"
     79 	sed '1,/^$$/d' src/pashage.sh >>"$@"
     80 	echo >>"$@"
     81 	echo '############' >>"$@"
     82 	sed '1,/^############$$/d' src/run.sh >>"$@"
     83 	chmod a+x "$@"