[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: spaces...
From: |
Fabrice GIRARDOT |
Subject: |
Re: spaces... |
Date: |
Mon, 31 Mar 2008 14:12:07 +0200 |
User-agent: |
Thunderbird 2.0.0.12 (Windows/20080213) |
address@hidden a écrit :
Or what other solution is possible to test if a file (with spaces in his
name) exist ?
You may try something like this :
# Testing "windir" var to find if we're running on Windows
ifdef windir
SHELL = cmd.exe
SEP := $(strip \ )
define is-file-present
$(shell if exist "$(subst /,$(SEP),$(1))" (echo 1) else (echo 0))
endef
else
SHELL = /bin/sh
SEP := /
define is-file-present
$(if $(wildcard $(1)),1,0)
endef
endif
MY_FILE1 := C:/Program Files/GNU/WinCvs 2.0/wincvs.exe
MY_FILE2 := C:/Program Files/GNU/WinCvs 2.0/wincvs.e_e
ifeq ($(call is-file-present,$(MY_FILE1)),1)
$(info $(MY_FILE1) is present)
else
$(info $(MY_FILE1) is not present)
endif
ifeq ($(call is-file-present,$(MY_FILE2)),1)
$(info $(MY_FILE2) is present)
else
$(info $(MY_FILE2) is not present)
endif
.PHONY: all
all:
@echo Hello world
Output :
C:\>gnumake
C:/Program Files/GNU/WinCvs 2.0/wincvs.exe is present
C:/Program Files/GNU/WinCvs 2.0/wincvs.e_e is not present
Hello world
Regards,
--
Fabrice GIRARDOT