$OpenBSD: patch-src_Makefile,v 1.3 2018/07/24 13:09:47 fcambus Exp $
Index: src/Makefile
--- src/Makefile.orig
+++ src/Makefile
@@ -2,7 +2,7 @@
 
 CC=gcc
 CFLAGS0:=$(CFLAGS)
-CFLAGS+=-I. -Wall -W -O3
+CFLAGS+=-I. -Wall -W
 LDFLAGS0:=$(LDFLAGS)
 ifeq ($(findstring darwin,$(OSTYPE)),) # false if OSTYPE contains "darwin"
 # On Mac OS X using -s gives the following warning:
@@ -54,10 +54,12 @@ endif
 
 else                                    # UNIX, BeOS or Mac OS X (Darwin)
 
+ifdef USE_PARALLEL
 ifeq ($(findstring openbsd,$(OSTYPE)),openbsd) # for example "openbsd3.4"
-# i386_iopl() is located in libi386.a
-LDFLAGS+=$(LIBI386)
+# i386_iopl() is located in libi386.a. Use -lamd64 for amd64_iopl().
+LDFLAGS+=$(LIBIOPL_OPENBSD)
 endif
+endif
 
 ifdef USE_DISCMAGE
 ifeq ($(findstring darwin,$(OSTYPE)),darwin) # for example "darwin7.0"
@@ -231,7 +233,7 @@ ifdef USE_DISCMAGE
 .PHONY: libdiscmage/$(FULLLIBNAME_DM)
 libdiscmage/$(FULLLIBNAME_DM):
 ifeq ($(GCC_WIN),1)
-	cd libdiscmage && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
+	cd libdiscmage && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
 else
 ifdef DJGPP
 	cd libdiscmage
@@ -240,7 +242,7 @@ ifdef DJGPP
 	$(MAKE)
 	cd ..
 else
-	cd libdiscmage && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
+	cd libdiscmage && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
 endif                                   # DJGPP
 endif                                   # GCC_WIN
 endif                                   # USE_DISCMAGE
@@ -250,7 +252,7 @@ ifdef USE_LIBCD64
 #.PHONY: backup/libcd64/libcd64.a  Do not force linking an executable.
 backup/libcd64/libcd64.a:
 ifeq ($(GCC_WIN),1)
-	cd backup/libcd64 && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
+	cd backup/libcd64 && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
 else
 ifdef DJGPP
 	cd backup/libcd64
@@ -259,7 +261,7 @@ ifdef DJGPP
 	$(MAKE)
 	cd ../..
 else
-	cd backup/libcd64 && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
+	cd backup/libcd64 && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
 endif                                   # DJGPP
 endif                                   # GCC_WIN
 endif                                   # USE_LIBCD64
