diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 17427f32e834ab2482718453f4aa1fb6142f7b3e..c2169befe050fa2f7458515cd29c92a626a14456 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -306,7 +306,7 @@ install:
 endif
 
 installlib: all install-headers
-	install -m 644 $(LIB) $(prefix)/lib
+	install -m 644 $(LIB) "$(prefix)/lib"
 
 install-headers:
 	mkdir -p "$(prefix)/include/ffmpeg"
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8147c95bee7911444baa8f989364aae543b6b6e1..db7562eb5f4f11c40cde0017d394d13a3211469b 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -125,7 +125,7 @@ install:
 endif
 
 installlib: all install-headers
-	install -m 644 $(LIB) $(prefix)/lib
+	install -m 644 $(LIB) "$(prefix)/lib"
 
 install-headers:
 	mkdir -p "$(prefix)/include/ffmpeg"