From da727fb28dca528f01fecd311e4268a7fbfc06a8 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 22 Sep 2010 21:19:47 +0800 Subject: [PATCH] update makefile --- Makefile | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ef71eb8..d8e6d75 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,8 @@ CURL_OPT= RECORD_SCRIPT=.mkrecord TAR=tar czvf +GIT_SOURCES= + # INTERNAL FUNCTIONS {{{ record_file = \ PTYPE=`cat $(1) | perl -nle 'print $$1 if /^"\s*script\s*type:\s*(\S*)$$/i'` ;\ @@ -71,6 +73,35 @@ record_file = \ # PUBLIC FUNCTIONS {{{ +GIT_SOURCES= +DEPEND_DIR=/tmp/vim-deps + +# Usage: +# +# $(call install_git_sources) +# + +install_git_source = \ + PWD=$(PWD) ; \ + mkdir -p $(DEPEND_DIR) ; \ + cd $(DEPEND_DIR) ; \ + for git_uri in $(GIT_SOURCES) ; do \ + OUTDIR=$$(echo $$git_uri | perl -pe 's{^.*/}{}') ;\ + echo $$OUTDIR ; \ + if [[ -e $$OUTDIR ]] ; then \ + cd $$OUTDIR ; \ + git pull origin master && \ + make install && cd .. ; \ + else \ + git clone $$git_uri $$OUTDIR && \ + cd $$OUTDIR && \ + make install && cd .. ; \ + fi; \ + done ; + + + + # install file by inspecting content install_file = \ PTYPE=`cat $(1) | perl -nle 'print $$1 if /^"\s*script\s*type:\s*(\S*)$$/i'` ;\ @@ -97,6 +128,13 @@ fetch_url = \ ; fi \ ; echo $(2) >> .bundlefiles + +install_source = \ + for git_uri in $(GIT_SOURCES) ; do \ + OUTDIR=$$(echo $$git_uri | perl -pe 's{^.*/}{}') ;\ + echo $$OUTDIR ; \ + done + # fetch script from github fetch_github = \ @if [[ -e $(5) ]] ; then \ @@ -173,14 +211,20 @@ CONFIG_FILE=config.mk # ======= SECTIONS ======= {{{ -include ext.mk -all: install +all: install-deps install +install-deps: + # check required binaries + [[ -n $$(which git) ]] + [[ -n $$(which bash) ]] + [[ -n $$(which vim) ]] + [[ -n $$(which wget) || -n $$(which curl) ]] + $(call install_git_sources) check-require: @if [[ -n `which wget` || -n `which curl` || -n `which fetch` ]]; then echo "wget|curl|fetch: OK" ; else echo "wget|curl|fetch: NOT OK" ; fi @if [[ -n `which vim` ]] ; then echo "vim: OK" ; else echo "vim: NOT OK" ; fi - config: @rm -f $(CONFIG_FILE) @echo "NAME=" >> $(CONFIG_FILE)