189 lines
5.5 KiB
Makefile
189 lines
5.5 KiB
Makefile
ifneq (,$(or $(ComSpec),$(COMSPEC),$(comspec)))
|
|
ifneq (Cygwin,$(shell uname -a))
|
|
NULL := /dev/null
|
|
fixpath = $(1)
|
|
emacspath = $(foreach f,$(1),$(shell cygpath -ma $(f)))
|
|
else ifneq (,$(MSYSTEM))
|
|
fixpath = $(foreach f,$(1),$(if $(subst $(f),,$(subst :,,$(f))),\
|
|
$(subst //,/,/$(firstword $(subst :, ,$(f)))$(subst \,/,$(lastword $(subst :, ,$(f))))),$(f)))
|
|
ifneq (,$(filter MSYS% MINGW%,$(MSYSTEM)))
|
|
#$(info test: $(filter MSYS% MINGW%,$(MSYSTEM)))
|
|
emacspath = $(foreach f,$(1),$(subst /,\\\\,$(shell cd $(f)&&pwd -W)))
|
|
else
|
|
RM := del
|
|
DIRSEP := $(if T,\)
|
|
SHQ := ^
|
|
RD := rmdir /q /s
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
dummy :=
|
|
sp := $(dummy) $(dummy)
|
|
PARENO := (
|
|
PARENC := )
|
|
|
|
DIRSEP ?= /
|
|
SHQ ?= $(if T,\)
|
|
emacspath ?= $(1)
|
|
fixpath ?= $(1)
|
|
|
|
TEST := test
|
|
RD ?= rm -rf
|
|
|
|
NULL ?= $(or $(wildcard /dev/null),nul)
|
|
|
|
HG := hg
|
|
GIT := git
|
|
BZR := bzr
|
|
SVN := svn
|
|
#BZR := "$(subst /,$(DIRSEP),$(or $(wildcard c:/Program?Files/Bazaar/bzr.exe),bzr))"
|
|
CVS := "$(subst /,$(DIRSEP),$(or $(wildcard c:/Program?Files/CVS?Suite/cvs.exe),cvs))"
|
|
#CVS := evs
|
|
|
|
CVSFLAGS := $(shell cvs --lf --version 2>$(NULL) >$(NULL)&&echo --lf)
|
|
CVSUP_FLAGS := -CPd
|
|
|
|
all: update
|
|
|
|
initrepos : subrepos
|
|
|
|
.PHONY: update subrepos clean-subrepos initrepos
|
|
|
|
define HG_TMPL
|
|
.PHONY: pull-$1
|
|
update: pull-$1
|
|
subrepos: $1
|
|
clean-subrepos: $1
|
|
DIR-$1 := $1
|
|
$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[hg]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$(HG) clone $2 $$@
|
|
|
|
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
|
|
clean-subrepos: $1
|
|
DIR-$1 := $1
|
|
$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[svn]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$(SVN) checkout $2 $$@
|
|
|
|
up-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[svn]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
@pushd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(SVN) $(SVNFLAGS) update $(SVNUP_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
define CVS_TMPL
|
|
.PHONY: up-$1
|
|
update: up-$1
|
|
DIR-$1 := $1
|
|
.PHONY: $1
|
|
initrepos: $1
|
|
$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[cvs]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$(RD) $$@
|
|
$(CVS) -z3 -d:$2 co $$@
|
|
|
|
up-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[cvs]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
@pushd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(CVS) $(CVSFLAGS) up $(CVSUP_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
define GIT_TMPL
|
|
.PHONY: pull-$1
|
|
update: pull-$1
|
|
ifneq (,$(filter http:% https:%,$2))
|
|
subrepos: $1
|
|
clean-subrepos: $1
|
|
else
|
|
.PHONY: $1
|
|
initrepos: $1
|
|
endif
|
|
DIR-$1 := $1
|
|
$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[git]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
ifeq (,$(filter http:% https:%,$2))
|
|
$(RD) $$@
|
|
endif
|
|
$(GIT) clone $2 $$@
|
|
|
|
pull-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[git]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
@pushd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(GIT) pull $(GITPULL_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
define BZR_TMPL
|
|
.PHONY: pull-$1
|
|
update: pull-$1
|
|
subrepos: $1
|
|
clean-subrepos: $1
|
|
DIR-$1 := $1
|
|
$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Creating[bzr]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)'
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$(BZR) branch $2 $$@
|
|
|
|
pull-$1:
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
@echo +++ Updating[bzr]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
|
|
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
$$(pre_up_cmd-$1)
|
|
pushd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(BZR) pull $(BZRPULL_FLAGS)
|
|
$$(post_up_cmd-$1)
|
|
|
|
endef
|
|
|
|
clean-subrepos:
|
|
echo $(RD) $^
|
|
|
|
#$(foreach dir,$(CVS_DIRS),$(info $(call CVS_UP_TMPL,$(dir))))
|
|
#$(foreach dir,$(GIT_DIRS),$(info $(call GIT_UP_TMPL,$(dir))))
|
|
|
|
#$(foreach dir,$(HG_DIRS) ,$(eval $(call HG_UP_TMPL,$(dir))))
|
|
#$(foreach dir,$(CVS_DIRS),$(eval $(call CVS_UP_TMPL,$(dir))))
|
|
#$(foreach dir,$(SVN_DIRS),$(eval $(call SVN_UP_TMPL,$(dir))))
|
|
#$(foreach dir,$(GIT_DIRS),$(eval $(call GIT_UP_TMPL,$(dir))))
|
|
#$(foreach dir,$(BZR_DIRS),$(eval $(call BZR_UP_TMPL,$(dir))))
|
|
|
|
|
|
# Local Variables:
|
|
# tab-width: 2
|
|
# End:
|