--- builds/posix/prefix.freebsd_amd64	2024-08-08 01:59:40.000000000 -0700
+++ builds/posix/prefix.freebsd_amd64	2025-01-01 17:05:51.322698000 -0800
@@ -20,10 +20,18 @@
 
 EXE_LINK_OPTIONS := $(LDFLAGS) $(THR_FLAGS) $(UNDEF_FLAGS) $(LIB_PATH_OPTS) -Wl,-rpath,../gen/firebird/lib
 
-PROD_FLAGS=-O -fno-builtin -DFREEBSD -DAMD64 -pipe -MMD -fPIC
-DEV_FLAGS=-ggdb -DFREEBSD -DAMD64 -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dtor
+COMMON_FLAGS=-DFREEBSD -DAMD64 -pipe -MMD -fPIC 
+PROD_FLAGS=$(COMMON_FLAGS) -O0 -g -fno-builtin -Wno-deprecated
+DEV_FLAGS=$(COMMON_FLAGS) -ggdb -p -Wall -Wno-non-virtual-dtor
 
 # This file must be compiled with SSE4.2 support
+%/CRC32C.o: COMMON_FLAGS += -msse4
+
+# These files are generated incorrectly (e.g. array.epp => array.cpp)
+%/array.o %/blob.o %/alice_meta.o %/restore.o %/backup.o: COMMON_FLAGS += -Wno-narrowing
+%/OdsDetection.o %/dba.o: COMMON_FLAGS += -Wno-narrowing
+
+# This file must be compiled with SSE4.2 support
 %/CRC32C.o: CXXFLAGS += -msse4
 
-CXXFLAGS := $(CXXFLAGS) -std=c++11
+CXXFLAGS := $(CXXFLAGS) -std=c++17
