update mk files

This commit is contained in:
Kai Tetzlaff 2012-08-05 22:33:54 +02:00
parent 84bfa93de9
commit e46a2eefcb
3 changed files with 116 additions and 136 deletions

View File

@ -26,6 +26,12 @@ else
emacspath = $(1)
endif
HG_DIRS :=
GIT_DIRS :=
BZR_DIRS :=
SVN_DIRS :=
CVS_DIRS :=
#SHELL := sh.exe -x
#$(error E:$(EMACS))
#$(error '$(value fixpath-emacs)' '$(value emacspath)')

View File

@ -86,18 +86,20 @@ ifneq (,$(or $(ComSpec),$(COMSPEC),$(comspec)))
DIRSEP := $(strip \)
NULL := nul
fixpath-make = $(subst \,/,$(subst $(sp),?,$(1)))
MD := mkdir
endif
endif
HOSTENV ?= unix
DIRSEP ?= /
SHQ ?= $(if T,\)
SHQ ?= $(strip \)
fixpath-make ?= $(1)
fixpath-shell ?= $(1)
TEST := test
RD ?= rm -rf
RM ?= rm -f
RD ?= rm -rf
MD ?= mkdir -p
NULL ?= $(or $(wildcard /dev/null),nul)

240
vcs.mk
View File

@ -4,27 +4,15 @@ endif
$(call mk-debug-lno,+ included from$(addprefix $(\n) ,$(MAKEFILE_LIST)))
.PHONY: updaterepos subrepos clean-subrepos initrepos
.PHONY: updaterepos 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)
$(MAKE) -C $* $(@F)
HG := hg
GIT := git
@ -48,150 +36,134 @@ eval-vcs-template =\
$(eval $(call $1,$2,$(URL-$2)))
define HG_TMPL
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1
updaterepos: pull-$1
subrepos: $1/.hg
clean-subrepos: $1/.hg
$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
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1
updaterepos: pull-$1
initrepos: $1/.hg
$1/.hg:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[hg]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$(RD) $(subst /,$(DIRSEP),$1)
$$(pre_init_cmd-$1)
$(HG) clone $2 $1
$$(post_init_cmd-$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)
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)
endif
endif
endef
define SVN_TMPL
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: up-$1
updaterepos: up-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.svn
clean-subrepos: $1/.svn
else
.PHONY: $1/.svn
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: up-$1
updaterepos: up-$1
initrepos: $1/.svn
$1/.svn:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[svn]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$(RD) $(subst /,$(DIRSEP),$1)
$$(pre_init_cmd-$1)
$(SVN) checkout $2 $1
$$(post_init_cmd-$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)
endif
$1/.svn:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[svn]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ifneq (,$(filter http:% https:%,$2))
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
endif
$(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)
endif
endef
define CVS_TMPL
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: up-$1
updaterepos: up-$1
.PHONY: $1/CVS
initrepos: $1/CVS
$1/CVS:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[cvs]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$(TEST) ! -d $1/CVS || $(RD) $(subst /,$(DIRSEP),$1)
cd $(subst /,$(DIRSEP),$(dir $1)) && $(CVS) -z3 -d $2 co $(notdir $1)
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: up-$1
updaterepos: up-$1
initrepos: $1/CVS
$1/CVS:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[cvs]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$(RD) $(subst /,$(DIRSEP),$1)
$$(pre_init_cmd-$1)
cd $(subst /,$(DIRSEP),$(dir $1)) && $(CVS) -z3 -d $2 co $(notdir $1)
$$(post_init_cmd-$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)
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)
endif
endif
endef
define GIT_TMPL
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1
updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.git
clean-subrepos: $1/.git
else
.PHONY: $1/.git
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1
updaterepos: pull-$1
initrepos: $1/.git
endif
$1/.git:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[git]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ifneq (,$(filter http:% https:%,$2))
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
endif
$(GIT) clone $2 $1
$1/.git:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[git]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$(RD) $(subst /,$(DIRSEP),$1)
$$(pre_init_cmd-$1)
$(GIT) clone $2 $1
$$(post_init_cmd-$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)
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)
endif
endif
endef
define BZR_TMPL
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1
updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.bzr
clean-subrepos: $1/.bzr
else
.PHONY: $1/.bzr
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1
updaterepos: pull-$1
initrepos: $1/.bzr
endif
$1/.bzr:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[bzr]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ifneq (,$(filter http:% https:%,$2))
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
endif
$(BZR) branch $2 $1
$1/.bzr:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[bzr]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$(RD) $(subst /,$(DIRSEP),$1)
$$(pre_init_cmd-$1)
$(BZR) branch $2 $1
$$(post_init_cmd-$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)
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)
endif
endif
endef