181 lines
5.2 KiB
Makefile
181 lines
5.2 KiB
Makefile
ifndef HAS_UTIL_MK
|
|
include $(HOME)/Documents/mk/util.mk
|
|
endif
|
|
|
|
$(call mk-debug-lno,+ included from$(addprefix $(\n) ,$(MAKEFILE_LIST)))
|
|
|
|
.PHONY: updaterepos subrepos clean-subrepos initrepos
|
|
|
|
all: updaterepos
|
|
|
|
initrepos : subrepos
|
|
|
|
clean-subrepos:
|
|
echo $(RD) $^
|
|
|
|
%/updaterepos:
|
|
$(MAKE) -C $* $(@F)
|
|
|
|
%/initrepos:
|
|
$(MAKE) -C $? $(@F)
|
|
|
|
%/subrepos:
|
|
$(MAKE) -C $? $(@F)
|
|
|
|
%/clean-subrepos:
|
|
$(MAKE) -C $? $(@F)
|
|
|
|
|
|
HG := hg
|
|
GIT := git
|
|
BZR := bzr
|
|
SVN := svn
|
|
#BZR := $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/Bazaar/bzr.exe))),bzr)
|
|
CVS := $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/CVS?Suite/cvs.exe))),cvs)
|
|
#CVS := evs
|
|
|
|
CVSFLAGS := $(shell cvs --lf --version 2>$(NULL) >$(NULL)&&echo --lf)
|
|
CVSUP_FLAGS := -CPd
|
|
|
|
ifneq (,$(filter http% HTTP%,$(PROXY)))
|
|
URL_FILTERS := http: https:
|
|
endif
|
|
|
|
eval-vcs-template =\
|
|
$(if $(filter $(or $(addsuffix %,$(subst +, ,$(URL_FILTERS))),%,),$(URL-$2)),$(eval $(call $1,$2,$(URL-$2))))
|
|
|
|
define HG_TMPL
|
|
.PHONY: pull-$1
|
|
updaterepos: pull-$1
|
|
subrepos: $1/.hg
|
|
clean-subrepos: $1/.hg
|
|
DIR-$(notdir $1) := $1
|
|
$1/.hg:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[hg]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
|
|
$(HG) clone $2 $1
|
|
|
|
pull-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[hg]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
$(HG) -R $(subst /,$(DIRSEP),$(subst $(DOT_DIR)/,,$1)) pull $(HGPULL_FLAGS)
|
|
$(HG) -R $(subst /,$(DIRSEP),$(subst $(DOT_DIR)/,,$1)) update $(HGPULL_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
define SVN_TMPL
|
|
.PHONY: up-$1
|
|
update: up-$1
|
|
subrepos: $1/.svn
|
|
clean-subrepos: $1/.svn
|
|
DIR-$(notdir $1) := $1
|
|
$1/.svn:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[svn]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
|
|
$(SVN) checkout $2 $1
|
|
|
|
up-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[svn]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(SVN) $(SVNFLAGS) update $(SVNUP_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
define CVS_TMPL
|
|
.PHONY: up-$1
|
|
updaterepos: up-$1
|
|
DIR-$(notdir $1) := $1
|
|
.PHONY: $1/CVS
|
|
initrepos: $1/CVS
|
|
$1/CVS:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[cvs]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
|
|
cd $(subst /,$(DIRSEP),$(dir $1)) && $(CVS) -z3 -d $2 co $(notdir $1)
|
|
|
|
up-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[cvs]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(CVS) $(CVSFLAGS) up $(CVSUP_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
define GIT_TMPL
|
|
.PHONY: pull-$1
|
|
updaterepos: pull-$1
|
|
ifneq (,$(filter http:% https:%,$2))
|
|
subrepos: $1/.git
|
|
clean-subrepos: $1/.git
|
|
else
|
|
.PHONY: $1/.git
|
|
initrepos: $1/.git
|
|
endif
|
|
DIR-$(notdir $1) := $1
|
|
$1/.git:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[git]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
ifeq (,$(filter http:% https:%,$2))
|
|
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
|
|
endif
|
|
$(GIT) clone $2 $1
|
|
|
|
pull-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[git]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(GIT) pull $(GITPULL_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
define BZR_TMPL
|
|
.PHONY: pull-$1
|
|
updaterepos: pull-$1
|
|
ifneq (,$(filter http:% https:%,$2))
|
|
subrepos: $1/.bzr
|
|
clean-subrepos: $1/.bzr
|
|
else
|
|
.PHONY: $1/.bzr
|
|
initrepos: $1/.bzr
|
|
endif
|
|
DIR-$(notdir $1) := $1
|
|
$1/.bzr:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[bzr]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
ifeq (,$(filter http:% https:%,$2))
|
|
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
|
|
endif
|
|
$(BZR) branch $2 $1
|
|
|
|
pull-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[bzr]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
cd $(subst /,$(DIRSEP),$1) && $(BZR) pull $(BZRPULL_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
|
|
# Local Variables:
|
|
# tab-width: 2
|
|
# End:
|