From f53ec4a499dabb88f6d89298d98ad8be961843f7 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Tue, 25 Mar 2008 20:26:59 +0000 Subject: Add support for handling paths containing spaces. Fix bug #353979. * SimpleMakefileHandler.cs (EscapeSpace): New. Escape and quote paths appropriately. * SolutionMakefileHandler.cs: Include Makefile.include also. * templates/Makefile.noauto.project.template: * templates/Makefile.am.project.template: Use emit_resgen_targets macro. Use '$(shell dirname ' instead of '$(dir ' as it can't handle paths with spaces. * templates/Makefile.include: * templates/make-dist.targets: * templates/Makefile.solution.template: * templates/rules.make: Add the necessary changes for the support. svn path=/trunk/monodevelop/; revision=98993 --- main/src/addins/MonoDevelop.Autotools/ChangeLog | 16 ++++++ .../SimpleProjectMakefileHandler.cs | 61 ++++++++++++---------- .../SolutionMakefileHandler.cs | 1 + .../templates/Makefile.am.project.template | 7 ++- .../templates/Makefile.include | 60 +++++++++++++++------ .../templates/Makefile.noauto.project.template | 6 +-- .../templates/Makefile.solution.template | 6 +-- .../templates/make-dist.targets | 10 ++-- .../MonoDevelop.Autotools/templates/rules.make | 26 +++++---- 9 files changed, 123 insertions(+), 70 deletions(-) (limited to 'main/src') diff --git a/main/src/addins/MonoDevelop.Autotools/ChangeLog b/main/src/addins/MonoDevelop.Autotools/ChangeLog index dbf847a422..6abfdb3a09 100644 --- a/main/src/addins/MonoDevelop.Autotools/ChangeLog +++ b/main/src/addins/MonoDevelop.Autotools/ChangeLog @@ -1,3 +1,19 @@ +2008-03-26 Ankit Jain + + Add support for handling paths containing spaces. + Fix bug #353979. + * SimpleMakefileHandler.cs (EscapeSpace): New. + Escape and quote paths appropriately. + * SolutionMakefileHandler.cs: Include Makefile.include also. + * templates/Makefile.noauto.project.template: + * templates/Makefile.am.project.template: Use emit_resgen_targets macro. + Use '$(shell dirname ' instead of '$(dir ' as it can't handle paths with + spaces. + * templates/Makefile.include: + * templates/make-dist.targets: + * templates/Makefile.solution.template: + * templates/rules.make: Add the necessary changes for the support. + 2008-03-04 Mike Krüger * ImportMakefileDialog.cs, MakefileOptionPanelWidget.cs, Commands.cs, diff --git a/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs index c6cd0d8d15..59abc2c9be 100644 --- a/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs @@ -150,12 +150,12 @@ namespace MonoDevelop.Autotools case BuildAction.Compile: if ( projectFile.Subtype != Subtype.Code ) continue; - files.AppendFormat ( "\\\n\t{0} ", pfpath ); + files.AppendFormat ( "\\\n\t{0} ", EscapeSpace (pfpath)); break; case BuildAction.Nothing: - extras.AppendFormat ( "\\\n\t{0} ", pfpath ); + extras.AppendFormat ( "\\\n\t{0} ", EscapeSpace (pfpath)); break; case BuildAction.EmbedAsResource: @@ -171,15 +171,15 @@ namespace MonoDevelop.Autotools pfpath = FileService.NormalizeRelativePath (pfpath); } if (!String.IsNullOrEmpty (projectFile.ResourceId) && projectFile.ResourceId != Path.GetFileName (pfpath)) - res_files.AppendFormat ( "\\\n\t{0},{1} ", pfpath, projectFile.ResourceId); + res_files.AppendFormat ( "\\\n\t{0},{1} ", EscapeSpace (pfpath), EscapeSpace (projectFile.ResourceId)); else - res_files.AppendFormat ( "\\\n\t{0} ", pfpath); + res_files.AppendFormat ( "\\\n\t{0} ", EscapeSpace (pfpath)); break; case BuildAction.FileCopy: - datafiles.AppendFormat ("\\\n\t{0} ", pfpath); + datafiles.AppendFormat ("\\\n\t{0} ", EscapeSpace (pfpath)); break; } } @@ -198,13 +198,14 @@ namespace MonoDevelop.Autotools programFilesDir = TranslateDir (programFilesDir); installDirs.Add (programFilesDir); installTarget.Append ("\tmake pre-install-local-hook prefix=$(prefix)\n"); - installTarget.AppendFormat ("\tmkdir -p $(DESTDIR){0}\n", programFilesDir); - installTarget.AppendFormat ("\tcp $(ASSEMBLY) $(ASSEMBLY_MDB) $(DESTDIR){0}\n", programFilesDir); + installTarget.AppendFormat ("\tmkdir -p '$(DESTDIR){0}'\n", programFilesDir); + installTarget.AppendFormat ("\t$(call cp,$(ASSEMBLY),$(DESTDIR){0})\n", programFilesDir); + installTarget.AppendFormat ("\t$(call cp,$(ASSEMBLY_MDB),$(DESTDIR){0})\n", programFilesDir); //remove dir? uninstallTarget.Append ("\tmake pre-uninstall-local-hook prefix=$(prefix)\n"); - uninstallTarget.AppendFormat ("\trm -f $(DESTDIR){0}/$(notdir $(ASSEMBLY))\n", programFilesDir); - uninstallTarget.AppendFormat ("\ttest -z '$(ASSEMBLY_MDB)' || rm -f $(DESTDIR){0}/$(notdir $(ASSEMBLY_MDB))\n", programFilesDir); + uninstallTarget.AppendFormat ("\t$(call rm,$(ASSEMBLY),$(DESTDIR){0})\n", programFilesDir); + uninstallTarget.AppendFormat ("\t$(call rm,$(ASSEMBLY_MDB),$(DESTDIR){0})\n", programFilesDir); installDeps.Append (" $(ASSEMBLY) $(ASSEMBLY_MDB)"); @@ -298,7 +299,7 @@ namespace MonoDevelop.Autotools project.GetRelativeChildPath ( dnpc.CompiledOutputName ) : project.GetRelativeChildPath ( dnpc.CompiledOutputName ).Replace("\\","/"); - projectReferences.Write ( pref ); + projectReferences.Write (EscapeSpace (pref)); } configSection.BuildVariablesBuilder.AppendFormat ( "PROJECT_REFERENCES = {0}\n", projectReferences.ToString() ); @@ -363,9 +364,10 @@ namespace MonoDevelop.Autotools if (configSection.DeployFileVars.ContainsKey (targetDeployVar)) { //use the dfile from the config section DeployFile dfile = configSection.DeployFileVars [targetDeployVar]; - string fname = FileService.AbsoluteToRelativePath ( - Path.GetFullPath (project.BaseDirectory), - Path.GetFullPath (dfile.SourcePath)); + string fname = EscapeSpace ( + FileService.AbsoluteToRelativePath ( + Path.GetFullPath (project.BaseDirectory), + Path.GetFullPath (dfile.SourcePath))); conf_vars.AppendFormat ("{0}_SOURCE={1}\n", targetDeployVar, fname); @@ -374,7 +376,7 @@ namespace MonoDevelop.Autotools conf_vars.AppendFormat ("{0}=$(BUILD_DIR){1}{2}\n", targetDeployVar, Path.DirectorySeparatorChar, - dfile.RelativeTargetPath); + EscapeSpace (dfile.RelativeTargetPath)); } } else { // not common and not part of @configSection @@ -396,7 +398,7 @@ namespace MonoDevelop.Autotools deployFileCopyVars.AppendFormat ("{0} = $(BUILD_DIR){1}{2}\n", pair.Key, Path.DirectorySeparatorChar, - pair.Value.RelativeTargetPath); + EscapeSpace (pair.Value.RelativeTargetPath)); } } @@ -504,10 +506,10 @@ namespace MonoDevelop.Autotools dllRefWriter.WriteLine (" \\"); dllRefWriter.Write ("\t"); - ctx.AddGlobalReferencedFile (FileService.AbsoluteToRelativePath ( - Path.GetFullPath (ctx.BaseDirectory), assemblyPath)); - dllRefWriter.Write (FileService.AbsoluteToRelativePath ( - project.BaseDirectory, assemblyPath)); + ctx.AddGlobalReferencedFile (EscapeSpace (FileService.AbsoluteToRelativePath ( + Path.GetFullPath (ctx.BaseDirectory), assemblyPath))); + dllRefWriter.Write (EscapeSpace (FileService.AbsoluteToRelativePath ( + project.BaseDirectory, assemblyPath))); } else if (reference.ReferenceType == ReferenceType.Project) @@ -568,14 +570,14 @@ namespace MonoDevelop.Autotools fname = FileService.NormalizeRelativePath ( FileService.AbsoluteToRelativePath (ctx.TargetCombine.BaseDirectory, full_fname)); infname = fname + ".in"; - ctx.AddAutoconfFile (fname); + ctx.AddAutoconfFile (EscapeSpace (fname)); ctx.AddGeneratedFile (full_fname + ".in"); //Path relative to project fname = FileService.NormalizeRelativePath ( FileService.AbsoluteToRelativePath (project.BaseDirectory, full_fname)); infname = fname + ".in"; - extras.AppendFormat ( "\\\n\t{0} ", infname); + extras.AppendFormat ( "\\\n\t{0} ", EscapeSpace (infname)); //dependencyDeployFile here should be filename relative to the project dependencyDeployFile = fname; @@ -588,7 +590,7 @@ namespace MonoDevelop.Autotools if (dfile.ContainsPathReferences) deployFileCopyTargets.AppendFormat ("$(eval $(call emit-deploy-wrapper,{0},{1}{2}))\n", targetDeployVar, - dependencyDeployFile, + EscapeSpace (dependencyDeployFile), (dfile.FileAttributes & DeployFileAttributes.Executable) != 0 ? ",x" : String.Empty); else deployFileCopyTargets.AppendFormat ("$(eval $(call emit-deploy-target,{0}))\n", targetDeployVar); @@ -623,14 +625,12 @@ namespace MonoDevelop.Autotools installDir = TranslateDir (installDir); if (!installDirs.Contains (installDir)) { - installTarget.AppendFormat ("\tmkdir -p $(DESTDIR){0}\n", installDir); + installTarget.AppendFormat ("\tmkdir -p '$(DESTDIR){0}'\n", installDir); installDirs.Add (installDir); } - installTarget.AppendFormat ("\ttest -z '$({0})' || cp $({0}) $(DESTDIR){1}\n", targetDeployVar, installDir); - installDeps.AppendFormat (" $({0})", targetDeployVar); - - uninstallTarget.AppendFormat ("\ttest -z '$({1})' || rm -f $(DESTDIR){0}/$(notdir $({1}))\n", installDir, targetDeployVar); + installTarget.AppendFormat ("\t$(call cp,$({0}),$(DESTDIR){1})\n", targetDeployVar, installDir); + uninstallTarget.AppendFormat ("\t$(call rm,$({1}),$(DESTDIR){0})\n", installDir, targetDeployVar); } } @@ -741,7 +741,12 @@ namespace MonoDevelop.Autotools return refp; } - + + static string EscapeSpace (string str) + { + return str.Replace (" ", "\\ "); + } + } } diff --git a/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs index 289d6afcf5..201dd04643 100644 --- a/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs @@ -60,6 +60,7 @@ namespace MonoDevelop.Autotools solutionTop.AppendFormat ("top_srcdir={0}\n", FileService.AbsoluteToRelativePath ( entry.BaseDirectory, ctx.TargetCombine.BaseDirectory)); solutionTop.Append ("include $(top_srcdir)/config.make\n"); + solutionTop.Append ("include $(top_srcdir)/Makefile.include\n"); solutionTop.Append ("include $(top_srcdir)/rules.make\n\n"); solutionTop.Append ("#include $(top_srcdir)/custom-hooks.make\n\n"); } diff --git a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template index b1635d7580..8db4b3ead2 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template +++ b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template @@ -1,6 +1,7 @@ # %%WARNING%% %%CONFIG_VARS%% +RESGEN=%%RESGEN%% all: $(ASSEMBLY) %%DEPLOY_FILE_VARS%% @@ -23,13 +24,11 @@ include $(top_srcdir)/Makefile.include %%COPY_DEPLOY_FILES_VARS%% %%COPY_DEPLOY_FILES_TARGETS%% +$(eval $(call emit_resgen_targets)) $(build_xamlg_list): %.xaml.g.cs: %.xaml xamlg '$<' -$(build_resx_resources) : %.resources: %.resx - %%RESGEN%% '$<' '$@' - $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list) - mkdir -p $(dir $(ASSEMBLY)) + mkdir -p $(shell dirname $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref) diff --git a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include index ff6288ce53..affd02e974 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include +++ b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include @@ -1,36 +1,62 @@ VALID_CULTURES = %%VALID_CULTURES%% +s2q=$(subst \ ,?,$1) +q2s=$(subst ?,\ ,$1) +# use this when result will be quoted +unesc2=$(subst ?, ,$1) + build_sources = $(FILES) $(GENERATED_FILES) -build_sources_embed = $(build_sources:%='$(srcdir)/%') +build_sources_esc= $(call s2q,$(build_sources)) +# use unesc2, as build_sources_embed is quoted +build_sources_embed= $(call unesc2,$(build_sources_esc:%='$(srcdir)/%')) comma__=, get_resource_name = $(firstword $(subst $(comma__), ,$1)) get_culture = $(lastword $(subst ., ,$(basename $1))) is_cultured_resource = $(and $(word 3,$(subst ., ,$1)), $(filter $(VALID_CULTURES),$(lastword $(subst ., ,$(basename $1))))) -build_resx_list = $(foreach res, $(RESOURCES), $(if $(filter %.resx, $(call get_resource_name,$(res))),$(res),)) +RESOURCES_ESC=$(call s2q,$(RESOURCES)) + +build_resx_list = $(foreach res, $(RESOURCES_ESC), $(if $(filter %.resx, $(call get_resource_name,$(res))),$(res),)) build_non_culture_resx_list = $(foreach res, $(build_resx_list),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res))) -build_non_culture_others_list = $(foreach res, $(filter-out $(build_resx_list),$(RESOURCES)),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res))) +build_non_culture_others_list = $(foreach res, $(filter-out $(build_resx_list),$(RESOURCES_ESC)),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res))) build_others_list = $(build_non_culture_others_list) build_xamlg_list = $(filter %.xaml.g.cs, $(FILES)) # resgen all .resx resources build_resx_files = $(foreach res, $(build_resx_list), $(call get_resource_name,$(res))) -build_resx_resources = $(build_resx_files:.resx=.resources) +build_resx_resources_esc = $(build_resx_files:.resx=.resources) +build_resx_resources = $(call q2s,$(build_resx_resources_esc)) # embed resources for the main assembly build_resx_resources_hack = $(subst .resx,.resources, $(build_non_culture_resx_list)) -build_resx_resources_embed = $(build_resx_resources_hack:%='-resource:%') -build_others_files = $(foreach res, $(build_others_list),$(call get_resource_name,$(res))) +# use unesc2, as build_resx_resources_embed is quoted +build_resx_resources_embed = $(call unesc2,$(build_resx_resources_hack:%='-resource:%')) +build_others_files = $(call q2s,$(foreach res, $(build_others_list),$(call get_resource_name,$(res)))) build_others_resources = $(build_others_files) -build_others_resources_embed = $(build_others_list:%='-resource:$(srcdir)/%') +# use unesc2, as build_others_resources_embed is quoted +build_others_resources_embed = $(call unesc2,$(build_others_list:%='-resource:$(srcdir)/%')) build_resources = $(build_resx_resources) $(build_others_resources) build_resources_embed = $(build_resx_resources_embed) $(build_others_resources_embed) -build_references_ref = $(foreach ref, $(REFERENCES), $(if $(filter -pkg:%, $(ref)), $(ref), $(if $(filter -r:%, $(ref)), $(ref), -r:$(ref)))) -build_references_ref += $(foreach ref, $(DLL_REFERENCES), -r:$(ref)) -build_references_ref += $(foreach ref, $(PROJECT_REFERENCES), -r:$(ref)) +# -usesourcepath is available only for resgen2 +emit_resgen_target_1=$(call q2s,$1) : $(call q2s,$(subst .resources,.resx,$1)); cd '$$(shell dirname '$$<')' && $$(RESGEN) '$$(shell basename '$$<')' '$$(shell basename '$$@')' +emit_resgen_target_2=$(call q2s,$1) : $(call q2s,$(subst .resources,.resx,$1)); $$(RESGEN) -usesourcepath '$$<' '$$@' + +emit_resgen_target=$(if $(filter resgen2,$(RESGEN)),$(emit_resgen_target_2),$(emit_resgen_target_1)) +emit_resgen_targets=$(foreach res,$(build_resx_resources_esc),$(eval $(call emit_resgen_target,$(res)))) + +build_references_ref = $(call q2s,$(foreach ref, $(call s2q,$(REFERENCES)), $(if $(filter -pkg:%, $(ref)), $(ref), $(if $(filter -r:%, $(ref)), $(ref), -r:$(ref))))) +build_references_ref += $(call q2s,$(foreach ref, $(call s2q,$(DLL_REFERENCES)), -r:$(ref))) +build_references_ref += $(call q2s,$(foreach ref, $(call s2q,$(PROJECT_REFERENCES)), -r:$(ref))) + +s2q2s=$(call unesc2,$(call s2q,$1)) +cp_actual=test -z $1 || cp $1 $2 +cp=$(call cp_actual,'$(call s2q2s,$1)','$(call s2q2s,$2)') + +rm_actual=test -z '$1' || rm -f '$2' +rm=$(call rm_actual,$(call s2q2s,$1),$(call s2q2s,$2)/$(shell basename '$(call s2q2s,$1)')) EXTRA_DIST += $(build_sources) $(build_resx_files) $(build_others_files) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(build_culture_res_files) CLEANFILES += $(ASSEMBLY) $(ASSEMBLY).mdb $(BINARIES) $(build_resx_resources) $(build_satellite_assembly_list) @@ -46,7 +72,7 @@ bin_SCRIPTS = $(BINARIES) # $(call emit-deploy-target,deploy-variable-name) define emit-deploy-target $($1): $($1_SOURCE) - mkdir -p $$(dir $($1)) + mkdir -p '$$(shell dirname '$$@')' cp '$$<' '$$@' endef @@ -55,7 +81,7 @@ endef # if $3 is non-empty then wrapper is marked exec define emit-deploy-wrapper $($1): $2 %%CONFIG_MAKE_DEP%% - mkdir -p '$$(@D)' + mkdir -p '$$(shell dirname '$$@')' cp '$$<' '$$@' $(if $3,chmod +x '$$@') %%WRAPPER_SED%% @@ -63,12 +89,12 @@ endef # generating satellite assemblies -culture_resources = $(foreach res, $(RESOURCES), $(if $(call is_cultured_resource,$(call get_resource_name, $(res))),$(res))) +culture_resources = $(foreach res, $(RESOURCES_ESC), $(if $(call is_cultured_resource,$(call get_resource_name, $(res))),$(res))) cultures = $(sort $(foreach res, $(culture_resources), $(call get_culture,$(call get_resource_name,$(res))))) -culture_resource_dependencies = $(BUILD_DIR)/$1/$(SATELLITE_ASSEMBLY_NAME): $(subst .resx,.resources,$2) -culture_resource_commandlines = cmd_line_satellite_$1 += '/embed:$(subst .resx,.resources,$2)' -build_satellite_assembly_list = $(cultures:%=$(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME)) -build_culture_res_files = $(foreach res, $(culture_resources),$(call get_resource_name,$(res))) +culture_resource_dependencies = $(call q2s,$(BUILD_DIR)/$1/$(SATELLITE_ASSEMBLY_NAME): $(subst .resx,.resources,$2)) +culture_resource_commandlines = $(call unesc2,cmd_line_satellite_$1 += '/embed:$(subst .resx,.resources,$2)') +build_satellite_assembly_list = $(call q2s,$(cultures:%=$(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME))) +build_culture_res_files = $(call q2s,$(foreach res, $(culture_resources),$(call get_resource_name,$(res)))) $(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_dependencies,$(call get_culture,$(call get_resource_name,$(res))),$(call get_resource_name,$(res)))))) $(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_commandlines,$(call get_culture,$(call get_resource_name,$(res))),$(res))))) diff --git a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template index 80583b1a32..c975a7b2a1 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template +++ b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.noauto.project.template @@ -1,6 +1,7 @@ # %%WARNING%% %%CONFIG_VARS%% +RESGEN=%%RESGEN%% %%COPY_DEPLOY_FILES_VARS%% FILES = %%FILES%% @@ -24,15 +25,14 @@ CLEANFILES = %%CLEANFILES%% %%COPY_DEPLOY_FILES_TARGETS%% %%TEMPLATE_FILES_TARGETS%% +$(eval $(call emit_resgen_targets)) $(build_xamlg_list): %.xaml.g.cs: %.xaml xamlg '$<' -$(build_resx_resources) : %.resources: %.resx - %%RESGEN%% '$<' '$@' %%CUSTOM_COMMAND_TARGETS%% $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list) make pre-all-local-hook prefix=$(prefix) - mkdir -p $(dir $(ASSEMBLY)) + mkdir -p $(shell dirname $(ASSEMBLY)) make $(CONFIG)_BeforeBuild $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref) make $(CONFIG)_AfterBuild diff --git a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.solution.template b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.solution.template index 07cc592cea..0642f36aa8 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/Makefile.solution.template +++ b/main/src/addins/MonoDevelop.Autotools/templates/Makefile.solution.template @@ -9,10 +9,10 @@ CONFIG_MAKE=$(top_srcdir)/config.make case $$2 in --unix) shift ;; esac; \ case $$2 in *=*) dk="exit 1" ;; *k*) dk=: ;; *) dk="exit 1" ;; esac; \ make pre-$*-hook prefix=$(prefix) ; \ - for dir in $(SUBDIRS); do \ - case $$dir in \ + for dir in $(call quote_each,SUBDIRS); do \ + case "$$dir" in \ .) make $*-local || { final_exit="exit 1"; $$dk; };;\ - *) (cd $$dir && make $*) || { final_exit="exit 1"; $$dk; };;\ + *) (cd "$$dir" && make $*) || { final_exit="exit 1"; $$dk; };;\ esac \ done; \ make post-$*-hook prefix=$(prefix) ; \ diff --git a/main/src/addins/MonoDevelop.Autotools/templates/make-dist.targets b/main/src/addins/MonoDevelop.Autotools/templates/make-dist.targets index cec5f6ac71..2227e45505 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/make-dist.targets +++ b/main/src/addins/MonoDevelop.Autotools/templates/make-dist.targets @@ -2,17 +2,17 @@ dist: $(CONFIG_MAKE) rm -rf $(PACKAGE)-$(VERSION) mkdir $(PACKAGE)-$(VERSION) make pre-dist-hook distdir=$$distdir - for dir in $(SUBDIRS); do \ + for dir in $(call quote_each,SUBDIRS); do \ pkgdir=`pwd`/$(PACKAGE)-$(VERSION); \ - mkdir $$pkgdir/$$dir || true; \ + mkdir "$$pkgdir/$$dir" || true; \ case $$dir in \ - .) make dist-local distdir=$$pkgdir || exit 1;; \ - *) (cd $$dir; make dist-local distdir=$$pkgdir/$$dir) || exit 1;; \ + .) make dist-local "distdir=$$pkgdir" || exit 1;; \ + *) (cd "$$dir"; make dist-local "distdir=$$pkgdir/$$dir") || exit 1;; \ esac \ done (make dist-local distdir=$(PACKAGE)-$(VERSION)) make - make post-dist-hook distsir=$$distdir + make post-dist-hook "distsir=$$distdir" tar czvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) rm -rf $(PACKAGE)-$(VERSION) @echo "==========================================" diff --git a/main/src/addins/MonoDevelop.Autotools/templates/rules.make b/main/src/addins/MonoDevelop.Autotools/templates/rules.make index 5f906b2402..a25a33ba3f 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/rules.make +++ b/main/src/addins/MonoDevelop.Autotools/templates/rules.make @@ -1,30 +1,36 @@ clean-local: make pre-clean-local-hook make $(CONFIG)_BeforeClean - -rm -f $(CLEANFILES) + -rm -f $(call quote_each,CLEANFILES) make $(CONFIG)_AfterClean make post-clean-local-hook install-local: uninstall-local: +all_esc=$(call s2q,$($1)) +all_quoted_esc=$(foreach f,$(call all_esc,$1),$(f:%='%')) +quote_each=$(call unesc2,$(call all_quoted_esc,$1)) + dist-local: - make pre-dist-local-hook distdir=$$distdir - list='$(EXTRA_DIST)'; \ - for f in Makefile $$list; do \ + make pre-dist-local-hook "distdir=$$distdir" + for f in $(call quote_each,EXTRA_DIST); do \ + files[$${#files[@]}]=$$f; \ + done; \ + for f in Makefile "$${files[@]}"; do \ d=`dirname "$$f"`; \ test -d "$(distdir)/$$d" || \ mkdir -p "$(distdir)/$$d"; \ cp -p "$$f" "$(distdir)/$$d" || exit 1; \ done - make post-dist-local-hook distdir=$$distdir + make post-dist-local-hook "distdir=$$distdir" dist-local-recursive: - for dir in $(SUBDIRS); do \ - mkdir -p $(distdir)/$$dir || true; \ - case $$dir in \ - .) make dist-local distdir=$(distdir) || exit 1;; \ - *) (cd $$dir; make dist-local distdir=$(distdir)/$$dir) || exit 1; \ + for dir in $(call quote_each,SUBDIRS); do \ + mkdir -p "$(distdir)/$$dir" || true; \ + case "$$dir" in \ + .) make dist-local "distdir=$(distdir)" || exit 1;; \ + *) (cd "$$dir"; make dist-local "distdir=$(distdir)/$$dir)" || exit 1; \ esac \ done -- cgit v1.2.3