123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- # Makefile module to deploy tfkit
- #
- # Will add bin/tfkit_init utility, and use it to guess URI to tfkit.git,
- # and clone tfkit to current directory.
- #
- # Adds targets: test to run tfkit tests, tfkit to deploy tfkit, tfkit_update to
- # pull tfkit updates, and tfkit_delete to remove the tfkit code.
- #
- # NOTE: Do not edit this file in your project directory as it will overwrite
- # itself when you call tfkit_update!!!
-
-
- test: tfkit
- @tfkit/runtests
-
- tfkit: bin/tfkit_init
- @bin/tfkit_init
-
- tfkit_delete:
- @rm -rf tfkit
- @rm -f bin/tfkit_init
- @rmdir bin 2>/dev/null || true
-
- bin/tfkit_init:
- @mkdir -p bin
- @echo '#!/bin/sh' >bin/tfkit_init
- @echo '' >>bin/tfkit_init
- @echo 'die() {' >>bin/tfkit_init
- @echo ' echo "$$1" >&2' >>bin/tfkit_init
- @echo ' exit 3' >>bin/tfkit_init
- @echo '}' >>bin/tfkit_init
- @echo '' >>bin/tfkit_init
- @echo 'if test -d tfkit/.git;' >>bin/tfkit_init
- @echo 'then' >>bin/tfkit_init
- @echo ' exit 0' >>bin/tfkit_init
- @echo 'else' >>bin/tfkit_init
- @echo '' >>bin/tfkit_init
- @echo ' origin=""' >>bin/tfkit_init
- @echo ' git remote | grep -q origin && origin=origin' >>bin/tfkit_init
- @echo ' test $$(git remote | wc -l) -eq 1 && origin=$$(git remote)' >>bin/tfkit_init
- @echo ' test -n "$$origin" || die "could not guess remote name"' >>bin/tfkit_init
- @echo '' >>bin/tfkit_init
- @echo '' >>bin/tfkit_init
- @echo ' uri=$$(git remote -v | grep "^$$origin.*(fetch)" | tr $$"\t" " " | cut -d\ -f2)' >>bin/tfkit_init
- @echo ' tfkit_uri=$$(dirname $$uri)/tfkit.git' >>bin/tfkit_init
- @echo '' >>bin/tfkit_init
- @echo ' git clone $$tfkit_uri || die "failed to clone tfkit"' >>bin/tfkit_init
- @echo '' >>bin/tfkit_init
- @echo 'fi' >>bin/tfkit_init
- @chmod +x bin/tfkit_init
-
- tfkit_update: tfkit
- @cd tfkit
- @git -C tfkit pull
- @cp tfkit/tfkit.mk .
-
- .PHONY: test
|