update mk

This commit is contained in:
Kai Tetzlaff (R&S) 2012-08-01 20:13:59 +02:00
parent 20fb7bf166
commit 33d35ac937
4 changed files with 183 additions and 144 deletions

View File

@ -1,5 +1,29 @@
EMACS_OSX := $(HOME)/Work/oss/build/osx/clang/64/dbg/emacs-new/nextstep/Emacs.app/Contents/MacOS/Emacs
EMACS := $(or $(wildcard $(EMACS_OSX)),emacs)
ifndef HAS_UTIL_MK
include $(HOME)/Documents/mk/util.mk
endif
EMACS_OSX := $(wildcard $(HOME)/Work/oss/build/osx/clang/64/dbg/emacs-new/nextstep/Emacs.app/Contents/MacOS/Emacs)
EMACS_W32 :=\
$(subst ?,$(sp),$(firstword\
$(subst $(sp),?,$(wildcard $(call fixpath-make,$(ProgramW6432)/emacs/bin/emacs.exe)))\
$(subst $(sp),?,$(wildcard $(call fixpath-make,$(ProgramFiles$(oparen)x86$(cparen))/emacs/bin/emacs.exe)))\
$(subst $(sp),?,$(wildcard $(call fixpath-make,$(ProgramFiles)/emacs/bin/emacs.exe)))))
EMACS := $(or $(EMACS_OSX),$(EMACS_W32),emacs)
ifeq (cygwin,$(HOSTENV))
ifneq (,$(findstring emacs/bin/emacs.exe,$(EMACS)))
EMACS_CYGWIN := emacs
fixpath-emacs = $(subst $(sp),?,$(shell cygpath -ma $(call fixpath-cyg,$(1))))
endif
else
fixpath-emacs = $(subst /,\\\\,$(shell cd $(1)&&pwd -W))
endif
fixpath-emacs ?= $(1)
emacspath = $(foreach f,$(1),$(call fixpath-emacs,$(f)))
#SHELL := sh.exe -x
#$(error E:$(EMACS))
@ -15,7 +39,7 @@ TEXI2DVI := texi2dvi
PS2PDF := ps2pdf
DVIPDFM := dvipdfm
CEDET_HOME := $(subst /cygdrive/d,,$(LISP_DIR)/cedet)
CEDET_HOME := $(LISP_DIR)/cedet
#$(error '$(call emacspath,.)')

View File

@ -2,10 +2,10 @@
# general emacs lisp pattern rules
# #########################################################################
%/elisp-all:
$(MAKE) -C $* $(@F)
"$(MAKE)" -C $* $(@F)
%.elc : %.el
$(EMACS) -batch -q -no-site-file\
"$(EMACS)" -batch -q -no-site-file\
$(addprefix -L ,$(LOAD_PATH))\
$(EMACSFLAGS)\
-f batch-byte-compile $(call emacspath,$?)

59
util.mk
View File

@ -3,26 +3,6 @@ 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
@ -93,10 +73,25 @@ sp := $(dummy) $(dummy)
PARENO := (
PARENC := )
ifneq (,$(or $(ComSpec),$(COMSPEC),$(comspec)))
ifneq (,$(filter Cygwin,$(shell uname -a)))
HOSTENV := cygwin
NULL := /dev/null
fixpath-shell = $(subst $(sp),\$(sp),$(subst $(oparen),\$(oparen),$(subst $(cparen),\$(cparen),$(subst \,/,$(1)))))
fixpath-cyg = $(call fixpath-shell,$(1))
fixpath-make = $(strip\
$(subst $(sp),?,$(shell cygpath $(call fixpath-cyg,$(1)))))
else
HOSTENV := w32
NULL := nul
fixpath-make = $(subst \,/,$(subst $(sp),?,$(1)))
endif
endif
DIRSEP ?= /
SHQ ?= $(if T,\)
emacspath ?= $(1)
fixpath ?= $(1)
fixpath-make ?= $(1)
fixpath-shell ?= $(1)
TEST := test
RD ?= rm -rf
@ -104,24 +99,24 @@ 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))'))
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
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')
$$(call mk-debug-lno,[WARN] could not find '$(1)')
endif
endif
endef
include-once = $(eval $(call include-once-helper,$1,$(subst $(sp),?,$1)))
include-once = $(eval $(call include-once-helper,$1,$(subst $(sp),?,$(1))))
# END: HAS_UTIL_MK
endif

102
vcs.mk
View File

@ -37,27 +37,31 @@ CVS := $(or $(patsubst %,"%",$(subst /,$(DIRSEP),$(wildcard c:/Program?Files/CVS
CVSFLAGS := $(shell cvs --lf --version 2>$(NULL) >$(NULL)&&echo --lf)
CVSUP_FLAGS := -CPd
ifneq (,$(filter http% HTTP%,$(PROXY)))
URL_FILTERS := http: https:
ifneq (,$(filter http% HTTP%,$(PROXY) $(http_proxy) $(HTTP_PROXY)))
URL_FILTERS := http:% https:%
endif
info-vcs-template =\
$(info $(call $1,$2,$(URL-$2)))
eval-vcs-template =\
$(if $(filter $(or $(addsuffix %,$(subst +, ,$(URL_FILTERS))),%,),$(URL-$2)),$(eval $(call $1,$2,$(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:
ifeq (,$(filter-out $(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
pull-$1:
pull-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[hg]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -66,22 +70,31 @@ pull-$1:
$(HG) -R $(subst /,$(DIRSEP),$(subst $(DOT_DIR)/,,$1)) update $(HGPULL_FLAGS)
$$(post_up_cmd-$1)
endif
endef
define SVN_TMPL
.PHONY: up-$1
update: up-$1
subrepos: $1/.svn
clean-subrepos: $1/.svn
DIR-$(notdir $1) := $1
$1/.svn:
ifeq (,$(filter-out $(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
initrepos: $1/.svn
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:
up-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[svn]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -89,22 +102,24 @@ up-$1:
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(SVN) $(SVNFLAGS) update $(SVNUP_FLAGS)
$$(post_up_cmd-$1)
endif
endef
define CVS_TMPL
.PHONY: up-$1
updaterepos: up-$1
DIR-$(notdir $1) := $1
.PHONY: $1/CVS
initrepos: $1/CVS
$1/CVS:
ifeq (,$(filter-out $(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)
up-$1:
up-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[cvs]: $$(patsubst up-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -112,29 +127,31 @@ up-$1:
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(CVS) $(CVSFLAGS) up $(CVSUP_FLAGS)
$$(post_up_cmd-$1)
endif
endef
define GIT_TMPL
.PHONY: pull-$1
updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(URL_FILTERS),$2))
.PHONY: pull-$1
updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.git
clean-subrepos: $1/.git
else
else
.PHONY: $1/.git
initrepos: $1/.git
endif
DIR-$(notdir $1) := $1
$1/.git:
endif
$1/.git:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[git]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ifeq (,$(filter http:% https:%,$2))
ifneq (,$(filter http:% https:%,$2))
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
endif
endif
$(GIT) clone $2 $1
pull-$1:
pull-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[git]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -142,29 +159,31 @@ pull-$1:
@cd $(subst /,$(DIRSEP),$1) >$(NULL) 2>&1 && $(GIT) pull $(GITPULL_FLAGS)
$$(post_up_cmd-$1)
endif
endef
define BZR_TMPL
.PHONY: pull-$1
updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
DIR-$(notdir $1) := $1
ifeq (,$(filter-out $(URL_FILTERS),$2))
.PHONY: pull-$1
updaterepos: pull-$1
ifneq (,$(filter http:% https:%,$2))
subrepos: $1/.bzr
clean-subrepos: $1/.bzr
else
else
.PHONY: $1/.bzr
initrepos: $1/.bzr
endif
DIR-$(notdir $1) := $1
$1/.bzr:
endif
$1/.bzr:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Creating[bzr]: $(SHQ)'$1$(SHQ)' from $(SHQ)'$2$(SHQ)'
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ifeq (,$(filter http:% https:%,$2))
ifneq (,$(filter http:% https:%,$2))
$(TEST) ! -d $1 || $(RD) $(subst /,$(DIRSEP),$1)
endif
endif
$(BZR) branch $2 $1
pull-$1:
pull-$1:
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@echo +++ Updating[bzr]: $$(patsubst pull-%,%,$$@) $(SHQ)($2$(SHQ))
@echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -172,6 +191,7 @@ pull-$1:
cd $(subst /,$(DIRSEP),$1) && $(BZR) pull $(BZRPULL_FLAGS)
$$(post_up_cmd-$1)
endif
endef