diff --git a/emacsd.mk b/emacsd.mk new file mode 100644 index 0000000..ada1b9b --- /dev/null +++ b/emacsd.mk @@ -0,0 +1,22 @@ +EMACS_OSX := $(HOME)/Work/oss/build/osx/clang/64/dbg/emacs-new/nextstep/Emacs.app/Contents/MacOS/Emacs +EMACS := $(or $(wildcard $(EMACS_OSX)),emacs) + +#SHELL := sh.exe -x +#$(error E:$(EMACS)) + +DOT_DIR := $(HOME)/.emacs.d +ELISP_DIR := $(DOT_DIR)/elisp-vcs +LISP_DIR := $(DOT_DIR)/lisp +INFO_DIR := $(DOT_DIR)/info + +MAKEINFO := makeinfo +TEXI2DVI := texi2dvi +PS2PDF := ps2pdf +DVIPDFM := dvipdfm + +CEDET_HOME := $(subst /cygdrive/d,,$(LISP_DIR)/cedet) + +#$(error '$(call emacspath,.)') + +#$(error fixpath: '$(call fixpath,$(HOME))') + diff --git a/util.mk b/util.mk new file mode 100644 index 0000000..e8a71fd --- /dev/null +++ b/util.mk @@ -0,0 +1,132 @@ +ifndef HAS_UTIL_MK +HAS_UTIL_MK := T + +MK_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) + +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 + +# define the $(\n) macro which has the value '\n' +# Note: This really requires two empty lines! +ifndef \n +define \n + + +endef +endif + +# define the $, or $(,) macro which has the value ',' +ifndef , + , := , +endif +ifndef comma + comma := , +endif + +# define the $(sp) macro which has the value ' ' +ifndef blank + blank := +endif +ifndef sp + sp := $(blank) $(blank) +endif + +# define the $= or $(=) macro which has the value '=' +ifndef equals + equals := = +endif +ifndef $(equals) + $(equals) := = +endif + +# define the $# or $(#) macro which has the value '#' +ifndef \# + hash := \# +endif +ifndef $(hash) + $(hash) := \# +endif + +# define the $: or $(:) macro which has the value ':' +ifndef colon + colon := : +endif +ifndef $(colon) + $(colon) := : +endif + +# define the $($$) macro which has the value '$' +ifndef dollar + dollar := $$ +endif +ifndef $(dollar) + $(dollar) := $$ +endif + +#define macros for '(' and ')' +ifndef oparen + oparen := ( +endif +ifndef cparen + cparen := ) +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) + +ifeq (T,$(V)) + mk-debug = $(info $1) + mk-debug-lno = $(warning $(\n)$1) + mk-debug-vars = $(foreach _mkv,$1,$(info $(_mkv) := '$($(_mkv))')) +endif + +define include-once-helper + ifndef $(subst ?,_,$(subst /,_,$2))-included + ifneq (,$(wildcard $2)) + $(subst ?,_,$(subst /,_,$2))-included := T + $$(call mk-debug-lno,+ including '$1') + include $2 + else + $$(call mk-debug-lno,[WARN] could not find '$1') + endif + endif +endef + +include-once = $(eval $(call include-once-helper,$1,$(subst $(sp),?,$1))) + +# END: HAS_UTIL_MK +endif + + +# Local Variables: +# tab-width: 2 +# End: diff --git a/vcs.mk b/vcs.mk index e76b5ff..846960b 100644 --- a/vcs.mk +++ b/vcs.mk @@ -1,37 +1,30 @@ -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 +ifndef HAS_UTIL_MK + include $(HOME)/Documents/mk/util.mk endif -dummy := -sp := $(dummy) $(dummy) -PARENO := ( -PARENC := ) +$(call mk-debug-lno,+ included from$(addprefix $(\n) ,$(MAKEFILE_LIST))) -DIRSEP ?= / -SHQ ?= $(if T,\) -emacspath ?= $(1) -fixpath ?= $(1) +.PHONY: updaterepos subrepos clean-subrepos initrepos -TEST := test -RD ?= rm -rf +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) -NULL ?= $(or $(wildcard /dev/null),nul) HG := hg GIT := git @@ -44,24 +37,25 @@ CVS := $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/CVS CVSFLAGS := $(shell cvs --lf --version 2>$(NULL) >$(NULL)&&echo --lf) CVSUP_FLAGS := -CPd -all: update +ifneq (,$(filter http% HTTP%,$(PROXY))) + URL_FILTERS := http: https: +endif -initrepos : subrepos - -.PHONY: update subrepos clean-subrepos initrepos +eval-vcs-template =\ + $(if $(filter $(or $(addsuffix %,$(subst +, ,$(URL_FILTERS))),%,),$(URL-$2)),$(eval $(call $1,$2,$(URL-$2)))) define HG_TMPL .PHONY: pull-$1 -update: pull-$1 -subrepos: $1 -clean-subrepos: $1 -DIR-$1 := $1 -$1: +updaterepos: pull-$1 +subrepos: $1/.hg +clean-subrepos: $1/.hg +DIR-$(notdir $1) := $1 +$1/.hg: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @echo +++ Creating[hg]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)' + @echo +++ Creating[hg]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - $(TEST) ! -d $$@ || $(RD) $$@ - $(HG) clone $2 $$@ + $(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1) + $(HG) clone $2 $1 pull-$1: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -77,121 +71,109 @@ endef define SVN_TMPL .PHONY: up-$1 update: up-$1 -subrepos: $1 -clean-subrepos: $1 -DIR-$1 := $1 -$1: +subrepos: $1/.svn +clean-subrepos: $1/.svn +DIR-$(notdir $1) := $1 +$1/.svn: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @echo +++ Creating[svn]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)' + @echo +++ Creating[svn]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - $(TEST) ! -d $$@ || $(RD) $$@ - $(SVN) checkout $2 $$@ + $(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) - @pushd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(SVN) $(SVNFLAGS) update $(SVNUP_FLAGS) + @cd $(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: +updaterepos: up-$1 +DIR-$(notdir $1) := $1 +.PHONY: $1/CVS +initrepos: $1/CVS +$1/CVS: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @echo +++ Creating[cvs]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)' + @echo +++ Creating[cvs]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - $(TEST) ! -d $$@ || $(RD) $$@ - pushd $$(@D) && $(CVS) -z3 -d:$2 co $$(@F) + $(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) - @pushd $(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) endef define GIT_TMPL .PHONY: pull-$1 -update: pull-$1 +updaterepos: pull-$1 ifneq (,$(filter http:% https:%,$2)) - subrepos: $1 - clean-subrepos: $1 + subrepos: $1/.git + clean-subrepos: $1/.git else - .PHONY: $1 - initrepos: $1 + .PHONY: $1/.git + initrepos: $1/.git endif -DIR-$1 := $1 -$1: +DIR-$(notdir $1) := $1 +$1/.git: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @echo +++ Creating[git]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)' + @echo +++ Creating[git]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ifeq (,$(filter http:% https:%,$2)) - $(TEST) ! -d $$@ || $(RD) $$@ + $(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1) endif - $(GIT) clone $2 $$@ + $(GIT) clone $2 $1 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) + @cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(GIT) pull $(GITPULL_FLAGS) $$(post_up_cmd-$1) endef define BZR_TMPL .PHONY: pull-$1 -update: pull-$1 +updaterepos: pull-$1 ifneq (,$(filter http:% https:%,$2)) - subrepos: $1 - clean-subrepos: $1 + subrepos: $1/.bzr + clean-subrepos: $1/.bzr else - .PHONY: $1 - initrepos: $1 + .PHONY: $1/.bzr + initrepos: $1/.bzr endif -DIR-$1 := $1 -$1: +DIR-$(notdir $1) := $1 +$1/.bzr: @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - @echo +++ Creating[bzr]: $(SHQ)'$$@$(SHQ)' from $(SHQ)'$2$(SHQ)' + @echo +++ Creating[bzr]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)' @echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ifeq (,$(filter http:% https:%,$2)) - $(TEST) ! -d $$@ || $(RD) $$@ + $(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1) endif - $(BZR) branch $2 $$@ + $(BZR) branch $2 $1 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) + cd $(subst /,$(DIRSEP),$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