From 257e023be6ef1505bfc17867e8ba1f03dc6f655e Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 28 Feb 2019 15:29:27 +0100 Subject: [PATCH] Add support for spaces in filenames (12/x) This takes care of dist files. GNU Make is required for this to work. --- src/makefile.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/makefile.c b/src/makefile.c index 6f0d6db..371dcfd 100644 --- a/src/makefile.c +++ b/src/makefile.c @@ -2688,9 +2688,8 @@ static int _install_include(Makefile * makefile, String const * include) static int _dist_check(Makefile * makefile, char const * target, char const * mode); -static int _dist_install(Makefile * makefile, - char const * directory, char const * mode, - char const * filename); +static int _dist_install(Makefile * makefile, char const * directory, + char const * mode, char const * filename); static int _install_dist(Makefile * makefile) { int ret = 0; @@ -2758,9 +2757,8 @@ static int _dist_check(Makefile * makefile, char const * target, return 0; } -static int _dist_install(Makefile * makefile, - char const * directory, char const * mode, - char const * filename) +static int _dist_install(Makefile * makefile, char const * directory, + char const * mode, char const * filename) { String * p; char const * q; @@ -2777,9 +2775,15 @@ static int _dist_install(Makefile * makefile, } else _makefile_mkdir(makefile, directory); - _makefile_print(makefile, "%s%s%s%s%s%s/%s\n", "\t$(INSTALL) -m ", - mode, " ", filename, " $(DESTDIR)", directory, - filename); + _makefile_print(makefile, "%s", "\t$(INSTALL) -m "); + _makefile_print_escape(makefile, mode); + _makefile_print(makefile, " "); + _makefile_print_escape(makefile, filename); + _makefile_print(makefile, " $(DESTDIR)"); + _makefile_print_escape(makefile, directory); + _makefile_print(makefile, "/"); + _makefile_print_escape(makefile, filename); + _makefile_print(makefile, "\n"); return 0; } @@ -3072,8 +3076,11 @@ static int _uninstall_dist(Makefile * makefile, if((install = _makefile_get_config(makefile, dist, "install")) == NULL) return 0; - _makefile_print(makefile, "%s%s/%s\n", "\t$(RM) -- $(DESTDIR)", install, - dist); + _makefile_print(makefile, "%s", "\t$(RM) -- $(DESTDIR)"); + _makefile_print_escape(makefile, install); + _makefile_print(makefile, "/"); + _makefile_print_escape(makefile, dist); + _makefile_print(makefile, "\n"); return 0; }