diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index e2e7e725a9c374cf6be16aff4cf8c4ab7251b7ce..ba0822383f2f83e40ac323f0b89015a6147854a1 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -263,7 +263,7 @@ X = @EXEEXT@
 
 ifneq (@PERL@,)
     # quoted to protect pathname with spaces
-    PERL		= "@PERL@"
+    PERL		= '@PERL@'
 else
     PERL		= $(missing) perl
 endif
@@ -437,7 +437,7 @@ endif
 pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
 
 pg_regress_check = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags)
-pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir="$(PSQLDIR)" $(pg_regress_locale_flags)
+pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir='$(PSQLDIR)' $(pg_regress_locale_flags)
 
 pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
 
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 53b527bcab7f6eb064a5467dd56f4ea89dc9f47b..983abc37ebd979b95c5c118876d32a975c425128 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -130,7 +130,7 @@ ifeq ($(PORTNAME), darwin)
     ifneq ($(SO_MAJOR_VERSION), 0)
       version_link	= -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
     endif
-    LINK.shared		= $(COMPILER) -dynamiclib -install_name "$(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)" $(version_link) $(exported_symbols_list) -multiply_defined suppress
+    LINK.shared		= $(COMPILER) -dynamiclib -install_name '$(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)' $(version_link) $(exported_symbols_list) -multiply_defined suppress
     shlib		= lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX)
     shlib_major		= lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
   else
diff --git a/src/backend/Makefile b/src/backend/Makefile
index bbc59f76c735cff31501d5ba9fd2b6beab5eada9..e156bb48aa75ac9bdc4e895b3a8d77548a8c064b 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -164,27 +164,27 @@ utils/probes.h: utils/probes.d
 # For headers generated during regular builds, we prefer a relative symlink.
 
 $(top_builddir)/src/include/parser/gram.h: parser/gram.h
-	prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
-	  cd $(dir $@) && rm -f $(notdir $@) && \
+	prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
+	  cd '$(dir $@)' && rm -f $(notdir $@) && \
 	  $(LN_S) "$$prereqdir/$(notdir $<)" .
 
 $(top_builddir)/src/include/catalog/schemapg.h: catalog/schemapg.h
-	prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
-	  cd $(dir $@) && rm -f $(notdir $@) && \
+	prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
+	  cd '$(dir $@)' && rm -f $(notdir $@) && \
 	  $(LN_S) "$$prereqdir/$(notdir $<)" .
 
 $(top_builddir)/src/include/utils/errcodes.h: utils/errcodes.h
-	cd $(dir $@) && rm -f $(notdir $@) && \
-	    $(LN_S) ../../../$(subdir)/utils/errcodes.h .
+	cd '$(dir $@)' && rm -f $(notdir $@) && \
+	    $(LN_S) "../../../$(subdir)/utils/errcodes.h" .
 
 $(top_builddir)/src/include/utils/fmgroids.h: utils/fmgroids.h
-	prereqdir=`cd $(dir $<) >/dev/null && pwd` && \
-	  cd $(dir $@) && rm -f $(notdir $@) && \
+	prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \
+	  cd '$(dir $@)' && rm -f $(notdir $@) && \
 	  $(LN_S) "$$prereqdir/$(notdir $<)" .
 
 $(top_builddir)/src/include/utils/probes.h: utils/probes.h
-	cd $(dir $@) && rm -f $(notdir $@) && \
-	    $(LN_S) ../../../$(subdir)/utils/probes.h .
+	cd '$(dir $@)' && rm -f $(notdir $@) && \
+	    $(LN_S) "../../../$(subdir)/utils/probes.h" .
 
 
 utils/probes.o: utils/probes.d $(SUBDIROBJS)
diff --git a/src/interfaces/ecpg/test/Makefile b/src/interfaces/ecpg/test/Makefile
index 2f954c63ce06bc8496af04d42e7f7785e9ccfce0..e899aef83c03e6703f8f30803e9fbe01aea072e2 100644
--- a/src/interfaces/ecpg/test/Makefile
+++ b/src/interfaces/ecpg/test/Makefile
@@ -5,8 +5,8 @@ top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 
 override CPPFLAGS := \
-	-I$(top_builddir)/src/port \
-	-I$(top_srcdir)/src/test/regress \
+	'-I$(top_builddir)/src/port' \
+	'-I$(top_srcdir)/src/test/regress' \
 	'-DHOST_TUPLE="$(host_tuple)"' \
 	'-DMAKEPROG="$(MAKE)"' \
 	'-DSHELLPROG="$(SHELL)"' \
@@ -84,4 +84,4 @@ checktcp: all
 	./pg_regress  --dbname=regress1,connectdb --top-builddir=$(top_builddir) --temp-install=./tmp_check $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule_tcp --create-role=connectuser,connectdb --host=localhost
 
 installcheck: all
-	./pg_regress  --psqldir="$(PSQLDIR)" --dbname=regress1,connectdb --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb
+	./pg_regress  --psqldir='$(PSQLDIR)' --dbname=regress1,connectdb --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(THREAD) --schedule=$(srcdir)/ecpg_schedule --create-role=connectuser,connectdb
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
index 7bf62ae2e8a806fc28b6c31eb06754dce2033527..fc759ec082d1c9980ee6ba210277cde027e851e4 100644
--- a/src/makefiles/Makefile.aix
+++ b/src/makefiles/Makefile.aix
@@ -9,9 +9,9 @@ AROPT = crs
 libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
 
 ifeq ($(host_os), aix3.2.5)
-	rpath = -L$(rpathdir)
+	rpath = -L'$(rpathdir)'
 else
-	rpath = -Wl,-blibpath:$(rpathdir)$(libpath)
+	rpath = -Wl,-blibpath:'$(rpathdir)$(libpath)'
 endif
 
 DLSUFFIX = .so
diff --git a/src/test/isolation/Makefile b/src/test/isolation/Makefile
index 0fe8d608cc8614b35b60a697107872747478c716..80a8a25bb3f13678f67a8c6726c0a2961547feac 100644
--- a/src/test/isolation/Makefile
+++ b/src/test/isolation/Makefile
@@ -73,7 +73,7 @@ maintainer-clean: distclean
 	rm -f specparse.c specscanner.c
 
 installcheck: all
-	./pg_isolation_regress --psqldir="$(PSQLDIR)" --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule
+	./pg_isolation_regress --psqldir='$(PSQLDIR)' --inputdir=$(srcdir) --schedule=$(srcdir)/isolation_schedule
 
 # We can't support "make check" because isolationtester requires libpq, and
 # in fact (on typical platforms using shared libraries) requires libpq to