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) emacspath = $(1)
endif endif
HG_DIRS :=
GIT_DIRS :=
BZR_DIRS :=
SVN_DIRS :=
CVS_DIRS :=
#SHELL := sh.exe -x #SHELL := sh.exe -x
#$(error E:$(EMACS)) #$(error E:$(EMACS))
#$(error '$(value fixpath-emacs)' '$(value emacspath)') #$(error '$(value fixpath-emacs)' '$(value emacspath)')

View File

@ -86,18 +86,20 @@ ifneq (,$(or $(ComSpec),$(COMSPEC),$(comspec)))
DIRSEP := $(strip \) DIRSEP := $(strip \)
NULL := nul NULL := nul
fixpath-make = $(subst \,/,$(subst $(sp),?,$(1))) fixpath-make = $(subst \,/,$(subst $(sp),?,$(1)))
MD := mkdir
endif endif
endif endif
HOSTENV ?= unix HOSTENV ?= unix
DIRSEP ?= / DIRSEP ?= /
SHQ ?= $(if T,\) SHQ ?= $(strip \)
fixpath-make ?= $(1) fixpath-make ?= $(1)
fixpath-shell ?= $(1) fixpath-shell ?= $(1)
TEST := test TEST := test
RD ?= rm -rf
RM ?= rm -f RM ?= rm -f
RD ?= rm -rf
MD ?= mkdir -p
NULL ?= $(or $(wildcard /dev/null),nul) 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))) $(call mk-debug-lno,+ included from$(addprefix $(\n) ,$(MAKEFILE_LIST)))
.PHONY: updaterepos subrepos clean-subrepos initrepos .PHONY: updaterepos initrepos
all: updaterepos all: updaterepos
initrepos : subrepos
clean-subrepos:
echo $(RD) $^
%/updaterepos: %/updaterepos:
$(MAKE) -C $* $(@F) $(MAKE) -C $* $(@F)
%/initrepos: %/initrepos:
$(MAKE) -C $? $(@F) $(MAKE) -C $* $(@F)
%/subrepos:
$(MAKE) -C $? $(@F)
%/clean-subrepos:
$(MAKE) -C $? $(@F)
HG := hg HG := hg
GIT := git GIT := git
@ -48,150 +36,134 @@ eval-vcs-template =\
$(eval $(call $1,$2,$(URL-$2))) $(eval $(call $1,$2,$(URL-$2)))
define HG_TMPL define HG_TMPL
DIR-$(notdir $1) := $1 DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2)) ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1 .PHONY: pull-$1
updaterepos: pull-$1 updaterepos: pull-$1
subrepos: $1/.hg initrepos: $1/.hg
clean-subrepos: $1/.hg $1/.hg:
$1/.hg: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo +++ Creating[hg]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo +++ Creating[hg]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $(RD) $(subst /,$(DIRSEP),$1)
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1) $$(pre_init_cmd-$1)
$(HG) clone $2 $1 $(HG) clone $2 $1
$$(post_init_cmd-$1)
pull-$1: pull-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[hg]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ)) @echo +++ Updating[hg]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$$(pre_up_cmd-$1) $$(pre_up_cmd-$1)
$(HG) -R $(subst /,$(DIRSEP),$(subst $(DOT_DIR)/,,$1)) pull $(HGPULL_FLAGS) $(HG) -R $(subst /,$(DIRSEP),$(subst $(DOT_DIR)/,,$1)) pull $(HGPULL_FLAGS)
$(HG) -R $(subst /,$(DIRSEP),$(subst $(DOT_DIR)/,,$1)) update $(HGPULL_FLAGS) $(HG) -R $(subst /,$(DIRSEP),$(subst $(DOT_DIR)/,,$1)) update $(HGPULL_FLAGS)
$$(post_up_cmd-$1) $$(post_up_cmd-$1)
endif endif
endef endef
define SVN_TMPL define SVN_TMPL
DIR-$(notdir $1) := $1 DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2)) ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: up-$1 .PHONY: up-$1
updaterepos: up-$1 updaterepos: up-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.svn
clean-subrepos: $1/.svn
else
.PHONY: $1/.svn
initrepos: $1/.svn 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 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 endef
define CVS_TMPL define CVS_TMPL
DIR-$(notdir $1) := $1 DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2)) ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: up-$1 .PHONY: up-$1
updaterepos: up-$1 updaterepos: up-$1
.PHONY: $1/CVS initrepos: $1/CVS
initrepos: $1/CVS $1/CVS:
$1/CVS: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo +++ Creating[cvs]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo +++ Creating[cvs]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $(RD) $(subst /,$(DIRSEP),$1)
$(TEST) ! -d $1/CVS || $(RD) $(subst /,$(DIRSEP),$1) $$(pre_init_cmd-$1)
cd $(subst /,$(DIRSEP),$(dir $1)) && $(CVS) -z3 -d $2 co $(notdir $1) cd $(subst /,$(DIRSEP),$(dir $1)) && $(CVS) -z3 -d $2 co $(notdir $1)
$$(post_init_cmd-$1)
up-$1: up-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[cvs]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ)) @echo +++ Updating[cvs]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$$(pre_up_cmd-$1) $$(pre_up_cmd-$1)
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(CVS) $(CVSFLAGS) up $(CVSUP_FLAGS) @cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(CVS) $(CVSFLAGS) up $(CVSUP_FLAGS)
$$(post_up_cmd-$1) $$(post_up_cmd-$1)
endif endif
endef endef
define GIT_TMPL define GIT_TMPL
DIR-$(notdir $1) := $1 DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2)) ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1 .PHONY: pull-$1
updaterepos: pull-$1 updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.git
clean-subrepos: $1/.git
else
.PHONY: $1/.git
initrepos: $1/.git initrepos: $1/.git
endif $1/.git:
$1/.git: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo +++ Creating[git]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo +++ Creating[git]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $(RD) $(subst /,$(DIRSEP),$1)
ifneq (,$(filter http:% https:%,$2)) $$(pre_init_cmd-$1)
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1) $(GIT) clone $2 $1
endif $$(post_init_cmd-$1)
$(GIT) clone $2 $1
pull-$1: pull-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[git]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ)) @echo +++ Updating[git]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$$(pre_up_cmd-$1) $$(pre_up_cmd-$1)
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(GIT) pull $(GITPULL_FLAGS) @cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(GIT) pull $(GITPULL_FLAGS)
$$(post_up_cmd-$1) $$(post_up_cmd-$1)
endif endif
endef endef
define BZR_TMPL define BZR_TMPL
DIR-$(notdir $1) := $1 DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2)) ifeq (,$(filter-out $(or $(URL_FILTERS),%),$2))
.PHONY: pull-$1 .PHONY: pull-$1
updaterepos: pull-$1 updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.bzr
clean-subrepos: $1/.bzr
else
.PHONY: $1/.bzr
initrepos: $1/.bzr initrepos: $1/.bzr
endif $1/.bzr:
$1/.bzr: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo +++ Creating[bzr]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo +++ Creating[bzr]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $(RD) $(subst /,$(DIRSEP),$1)
ifneq (,$(filter http:% https:%,$2)) $$(pre_init_cmd-$1)
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1) $(BZR) branch $2 $1
endif $$(post_init_cmd-$1)
$(BZR) branch $2 $1
pull-$1: pull-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[bzr]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ)) @echo +++ Updating[bzr]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$$(pre_up_cmd-$1) $$(pre_up_cmd-$1)
cd $(subst /,$(DIRSEP),$1) && $(BZR) pull $(BZRPULL_FLAGS) cd $(subst /,$(DIRSEP),$1) && $(BZR) pull $(BZRPULL_FLAGS)
$$(post_up_cmd-$1) $$(post_up_cmd-$1)
endif endif
endef endef