yochju / latex-makefile

Automatically exported from code.google.com/p/latex-makefile
Other
0 stars 0 forks source link

Fix for "make clean" error for file-names with "(" and/or ")" #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To fix the "make clean", I applied the following little patch (basically 
wrapping $1 with quotes in 'remove-files-helper') on version 2.2.0:

===================================================================
@@ -859,7 +859,7 @@

 # Don't call this directly - it is here to avoid calling wildcard more than
 # once in remove-files.
-remove-files-helper    = $(if $1,$(RM) $1,$(sh_true))
+remove-files-helper    = $(if "$1",$(RM) "$1",$(sh_true))

 # $(call remove-files,file1 file2)
 remove-files       = $(call remove-files-helper,$(wildcard $1))
===================================================================

Original issue reported on code.google.com by gsbabil on 7 Nov 2012 at 1:59

GoogleCodeExporter commented 9 years ago
I'm a bit skeptical of this. Does it actually work for multiple files? In 
particular, I'm really pretty sure that

rm "file1 file1"

will not do what we want - it will try to find a single file named "file1 
file2", so this fix is broken.

Note that $(wildcard $1) returns a space-separated list of files.

I think it's actually fine to simply not support files with ( and ) in their 
names.

Original comment by shiblon on 7 Nov 2012 at 9:33

GoogleCodeExporter commented 9 years ago
You are right. I was too hasty. It doesn't not work for the cases you 
pointed out. Also, it appears that GNU make has some serious troubles 
handling file-names with spaces AND these special characters.

Original comment by gsbabil on 7 Nov 2012 at 12:51

GoogleCodeExporter commented 9 years ago
I just added the following to support deleting user-defined files. The variable 
'clean_userdefined' can be specified in 'Makefile.ini' or 'Variables.ini' to 
perform cleaning of user-defined files.

===================================================================
 .PHONY: clean-nographics
 clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ;

+.PHONY: clean-userdefined
+clean-userdefined:
+   $(QUIET)$(call clean-files,$(clean_userdefined))
+
 .PHONY: clean
-clean: clean-generated clean-tex clean-graphics clean-deps clean-backups 
clean-auxiliary ;
+clean: clean-generated clean-tex clean-graphics clean-deps clean-backups 
clean-auxiliary clean-userdefined;

 #
 # HELP TARGETS
===================================================================

Original comment by gsbabil on 7 Nov 2012 at 1:17

GoogleCodeExporter commented 9 years ago
I'm accepting this patch, but calling it "CLEAN_EXTRA". I'll ping this bug when 
it's submitted.

Original comment by shiblon on 23 Nov 2012 at 3:02

GoogleCodeExporter commented 9 years ago
Actually, I'm going to just call it cleanextra (the variable, not the target - 
the target will be clean-extra).

Original comment by shiblon on 23 Nov 2012 at 3:04

GoogleCodeExporter commented 9 years ago
rd13ff27c27be has the fix.

Original comment by shiblon on 23 Nov 2012 at 3:08