$OpenBSD: patch-makefile,v 1.2 2017/11/03 15:33:04 bcallah Exp $

Remove -Werror* and add these -fno-* CFLAGS here.
Keep tendrils here to make generating future bootstraps easier.

Index: makefile
--- makefile.orig
+++ makefile
@@ -295,9 +295,7 @@ endif
 # ENABLE_PIC for non-x86 Linux etc. (for every system where we need separate
 # -fPIC versions of FB libs besides the normal ones)
 ifneq ($(filter freebsd linux netbsd openbsd solaris,$(TARGET_OS)),)
-  ifneq ($(TARGET_ARCH),x86)
     ENABLE_PIC := YesPlease
-  endif
 endif
 
 ifneq ($(filter cygwin dos win32,$(TARGET_OS)),)
@@ -393,7 +391,8 @@ endif
 
 ALLFBCFLAGS += -e -m fbc -w pedantic
 ALLFBLFLAGS += -e -m fbc -w pedantic
-ALLCFLAGS += -Wall -Wextra -Wno-unused-parameter -Werror-implicit-function-declaration
+ALLCFLAGS += -Wall -Wextra -Wno-unused-parameter
+ALLCFLAGS += -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
 
 ifeq ($(TARGET_OS),xbox)
   ifeq ($(OPENXDK),)
@@ -1050,32 +1049,16 @@ FBBOOTSTRAPTITLE := $(FBSOURCETITLE)-bootstrap
 bootstrap-dist:
 	# Precompile fbc sources for various targets
 	rm -rf bootstrap
-	mkdir -p bootstrap/dos
-	mkdir -p bootstrap/linux-x86
-	mkdir -p bootstrap/linux-x86_64
-	mkdir -p bootstrap/win32
-	mkdir -p bootstrap/win64
-	./$(FBC_EXE) src/compiler/*.bas -m fbc -i inc -e -r -v -target dos          && mv src/compiler/*.asm bootstrap/dos
-	./$(FBC_EXE) src/compiler/*.bas -m fbc -i inc -e -r -v -target linux-x86    && mv src/compiler/*.asm bootstrap/linux-x86
-	./$(FBC_EXE) src/compiler/*.bas -m fbc -i inc -e -r -v -target linux-x86_64 && mv src/compiler/*.c   bootstrap/linux-x86_64
-	./$(FBC_EXE) src/compiler/*.bas -m fbc -i inc -e -r -v -target win32        && mv src/compiler/*.asm bootstrap/win32
-	./$(FBC_EXE) src/compiler/*.bas -m fbc -i inc -e -r -v -target win64        && mv src/compiler/*.c   bootstrap/win64
+	mkdir -p bootstrap/openbsd-x86
+	mkdir -p bootstrap/openbsd-x86_64
+	fbc src/compiler/*.bas -m fbc -i inc -e -r -v -target openbsd-x86    && mv src/compiler/*.c bootstrap/openbsd-x86
+	fbc src/compiler/*.bas -m fbc -i inc -e -r -v -target openbsd-x86_64 && mv src/compiler/*.c bootstrap/openbsd-x86_64
 
 	# Ensure to have LFs regardless of host system (LFs will probably on
 	# DOS/Win32, but CRLFs could cause issues on Linux)
-	dos2unix bootstrap/dos/*
-	dos2unix bootstrap/linux-x86/*
-	dos2unix bootstrap/linux-x86_64/*
-	dos2unix bootstrap/win32/*
-	dos2unix bootstrap/win64/*
+	dos2unix bootstrap/openbsd-x86/*
+	dos2unix bootstrap/openbsd-x86_64/*
 
-	# Package FB sources (similar to our "gitdist" command), and add the bootstrap/ directory
-	# Making a .tar.xz should be good enough for now.
-	git -c core.autocrlf=false archive --format tar --prefix "$(FBBOOTSTRAPTITLE)/" HEAD | tar xf -
-	mv bootstrap $(FBBOOTSTRAPTITLE)
-	tar -cJf "$(FBBOOTSTRAPTITLE).tar.xz" "$(FBBOOTSTRAPTITLE)"
-	rm -rf "$(FBBOOTSTRAPTITLE)"
-
 #
 # Build the fbc[.exe] binary from the precompiled sources in the bootstrap/
 # directory.
@@ -1086,22 +1069,16 @@ bootstrap: rtlib gfxlib2 $(BOOTSTRAP_FBC)
 	mkdir -p bin
 	cp $(BOOTSTRAP_FBC) $(FBC_EXE)
 
-ifeq ($(TARGET_ARCH),x86)
-  # x86: .asm => .o (using the same assembler options as fbc)
-  BOOTSTRAP_OBJ = $(patsubst %.asm,%.o,$(sort $(wildcard bootstrap/$(FBTARGET)/*.asm)))
-  $(BOOTSTRAP_OBJ): %.o: %.asm
-	$(QUIET_AS)$(AS) --strip-local-absolute $< -o $@
-else
   # x86_64 etc.: .c => .o (using the same gcc options as fbc -gen gcc)
   BOOTSTRAP_CFLAGS := -nostdinc
   BOOTSTRAP_CFLAGS += -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable
   BOOTSTRAP_CFLAGS += -Wno-unused-but-set-variable -Wno-main
   BOOTSTRAP_CFLAGS += -fno-strict-aliasing -frounding-math
   BOOTSTRAP_CFLAGS += -Wfatal-errors
+  BOOTSTRAP_CFLAGS += ${CFLAGS}
   BOOTSTRAP_OBJ := $(patsubst %.c,%.o,$(sort $(wildcard bootstrap/$(FBTARGET)/*.c)))
   $(BOOTSTRAP_OBJ): %.o: %.c
 	$(QUIET_CC)$(CC) -c $(BOOTSTRAP_CFLAGS) $< -o $@
-endif
 
 # Use gcc to link fbc from the bootstrap .o's
 # (assuming the rtlib was built already)
