Subversion Repositories DevTools

Rev

Rev 245 | Rev 257 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 245 Rev 249
Line 175... Line 175...
175
#.. Generic Copy/Remove the specified file
175
#.. Generic Copy/Remove the specified file
176
#
176
#
177
#   Usage:      $(call CopyFile,Text,dest,file,path,fmode)
177
#   Usage:      $(call CopyFile,Text,dest,file,path,fmode)
178
#               $(call UncopyFile,Text,file)
178
#               $(call UncopyFile,Text,file)
179
#
179
#
-
 
180
#		Note: dest, file and path
-
 
181
#		    may have spaces in them
-
 
182
#		    These will have been escaped with a'\' which will
-
 
183
#		    need to be removed.
-
 
184
#
-
 
185
#		    May have '$' in themwhich we will need to escape
-
 
186
#
180
define CopyFile
187
define CopyFile
181
	@(echo ------ $1 "$2"; \
188
	@(dest="$(subst \$(space),$(space),$(subst $$,\$$,$(2)))"; \
182
        dest=$(subst $$,\$$,$(2)); file=$(subst $$,\$$,$(3)); path=$(4); fmode=$(5); \
189
        file="$(subst \$(space),$(space),$(subst $$,\$$,$(3)))"; \
-
 
190
        path="$(subst \$(space),$(space),$(subst $$,\$$,$(4)))"; \
-
 
191
        fmode="$(5)"; \
-
 
192
	echo ------ "$1 $$dest"; \
183
        if [ ! -f "$$file" ] ; then echo "$1 source file not found: $$file" ; exit 1; fi;\
193
        if [ ! -f "$$file" ] ; then echo "$1 source file not found: $$file" ; exit 1; fi;\
184
	if [ ! -d "$$path" ] ; then $(mkdir) -p "$$path"; fi; \
194
	if [ ! -d "$$path" ] ; then $(mkdir) -p "$$path"; fi; \
185
	if [ -f "$$dest" -a ! -w "$$dest" ]; then $(chmod) -f +w "$$dest"; fi; \
195
	if [ -f "$$dest" -a ! -w "$$dest" ]; then $(chmod) -f +w "$$dest"; fi; \
186
	$(rm) -f "$$dest"; \
196
	$(rm) -f "$$dest"; \
187
        $(cp) "$$file" "$$dest" ;\
197
        $(cp) "$$file" "$$dest" ;\
Line 190... Line 200...
190
        if [ ! -f "$$dest" ] ; then echo "$1 file not found after copy: $$dest" ; exit 1; fi; \
200
        if [ ! -f "$$dest" ] ; then echo "$1 file not found after copy: $$dest" ; exit 1; fi; \
191
        );
201
        );
192
endef
202
endef
193
 
203
 
194
define UncopyFile
204
define UncopyFile
195
	@(echo ------ $1 "$2"; \
205
	@(file="$(subst \$(space),$(space),$(subst $$,\$$,$(2)))"; \
196
        file=$(subst $$,\$$,$2); \
206
        echo ------ $1 "$$file"; \
197
	if [ -f "$$file" ]; then \
207
	if [ -f "$$file" ]; then \
198
		if [ ! -w "$$file" ]; then $(chmod) -f +w "$$file"; fi; \
208
		if [ ! -w "$$file" ]; then $(chmod) -f +w "$$file"; fi; \
199
		$(rm) -f "$$file"; \
209
		$(rm) -f "$$file"; \
200
	fi);
210
	fi);
201
endef
211
endef
202
 
212
 
203
 
-
 
204
##
213
##