ctr_firmware/trunk/build/buildtools/commondefs.cygpath
nakasima 58d5bae0e3 buildtools修正。
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@3 b871894f-2f95-9b40-918c-086798483c85
2008-11-07 09:21:34 +00:00

153 lines
4.1 KiB
Makefile

#! make -f
#----------------------------------------------------------------------------
# Project: CtrSDK
# File: commondefs
#
# Copyright 2008 Nintendo. All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law. They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
# $Date:: 2008-09-29#$
# $Rev: 8757 $
# $Author: adachi_hiroaki $
#----------------------------------------------------------------------------
ifndef CTRFIRM_COMMONDEFS_CYGPATH_
CTRFIRM_COMMONDEFS_CYGPATH_ = TRUE
#----------------------------------------------------------------
#
# cygpath
#
CYGPATH ?= cygpath
# 高速 cygpath は標準では無効 (make 3.80 では eval 関数に不具合があり動作しないため)
CYGPATH_NOCMD ?= FALSE
# 自動判別する場合は上の定義を消す(動作未確認)
#ifndef CYGPATH_NOCMD
#
#MAKE_VERSION := $(shell $(MAKE) -v | $(HEAD) -1 | $(AWK) '{print $3}')
#
#ifndef MSYSTEM
#
#ifeq ($(shell(expr "$(MAKE_VERSION)" ">=" "3.81")),1)
#CYGPATH_NOCMD=TRUE
#else # MAKE_VERSION
#CYGPATH_NOCMD=FALSE
#endif # MAKE_VERSION
#
#endif # MSYSTEM
#
#endif # CYGPATH_NOCMD
# cygdrive path prefix を取得
ifeq ($(CYGPATH_MOUNTPOINT),)
CYGPATH_MOUNTPOINT := $(patsubst %/,%,$(dir $(shell $(CYGPATH) -u c:/)))
endif # CYGPATH_MOUNTPOINT
ifeq ($(CYGPATH_NOCMD),TRUE)
ifeq ($(CYGPATH_DRIVELIST),)
# 安全
CYGPATH_DRIVELIST_ALL = $(shell DRIVES=`$(MOUNT) | $(GREP) 'type user' | $(CUT) -c1 | tr '\n' ' '` \
&& echo $${DRIVES} `echo $${DRIVES} | $(TR) '[a-z]' '[A-Z]'`)
# 最小限で速い
CYGPATH_DRIVELIST_FAST = $(shell $(CYGPATH) -aw '$(CTRSDK_ROOT)c' \
'$(CWFOLDER_CTR)c' '$(CWFOLDER_TWL)c' '$(CWFOLDER_NITRO)c' \
'$(CTRSYSTEM_ROOT)c' \
'$(IS_CTR_DIR)c' '$(IS_TWL_DIR)c' '$(IS_NITRO_DIR)c' \
| $(CUT) -c1)
CYGPATH_DRIVELIST := $(sort $(CYGPATH_DRIVELIST_FAST))
#CYGPATH_DRIVELIST := $(sort $(CYGPATH_DRIVELIST_ALL))
endif # CYGPATH_DRIVELIST
define cygpathm
$(strip $(eval VALUE=$(1))$(foreach DRIVE,$(CYGPATH_DRIVELIST),$(eval VALUE:=$$(patsubst $(CYGPATH_MOUNTPOINT)/$(DRIVE)/%,$(DRIVE):/%,$$(subst \,/,$$(VALUE)))))$(VALUE))
endef # cygpathm
define cygpathu
$(strip $(eval VALUE:=$(1))$(foreach DRIVE,$(CYGPATH_DRIVELIST),$(eval VALUE:=$$(patsubst $(DRIVE):/%,$(CYGPATH_MOUNTPOINT)/$(DRIVE)/%,$$(subst \,/,$$(VALUE)))))$(VALUE))
endef # cygpathu
define cygpathm_multi
$(foreach pathvar,$(1),$(call cygpathm,$(pathvar)))
endef # cygpathm_multi
define cygpathu_multi
$(foreach pathvar,$(1),$(call cygpathu,$(pathvar)))
endef # cygpathu_multi
define eupath
$(subst $(SPACE),\ ,$(call cygpathu,$(subst \ , ,$(1))))
endef # eupath
define empath
$(subst $(SPACE),\ ,$(call cygpathm,$(subst \ , ,$(1))))
endef # empath
else # CYGPATH_NOCMD
define empath
$(subst $(SPACE),\ ,$(shell $(CYGPATH) -m $(subst \,\\,$(subst \ , ,$(1)))))
endef # empath
ifdef MSYSTEM
define eupath
$(call empath,$(1))
endef #eupath
define cygpathu
$(shell cygpath -m $(subst \,\\,$(subst \ , ,$(1))))
endef
else # MSYSTEM
define eupath
$(subst $(SPACE),\ ,$(shell $(CYGPATH) -u $(subst \,\\,$(subst \ , ,$(1)))))
endef
define cygpathu
$(shell cygpath -u $(subst \,\\,$(subst \ , ,$(1))))
endef
endif # MSYSTEM
define cygpathm
$(shell cygpath -m $(subst \,\\,$(subst \ , ,$(1))))
endef
define cygpathu_multi
$(call cygpathu,$(1))
endef
define cygpathm_multi
$(call cygpathm,$(1))
endef
endif # CYGPATH_NOCMD
export CYGPATH_MOUNTPOINT CYGPATH_DRIVELIST CYGPATH_NOCMD
define encode_specialchar
$(subst $(SPACE),%20,$(1))
endef
define decode_specialchar
$(subst %20,$(SPACE),$(1))
endef
#----------------------------------------------------------------------------
endif # CTRFIRM_COMMONDEFS_CYGPATH_
#----- End of commondefs -----