diff --git a/gtests/net/packetdrill/Makefile.Darwin b/gtests/net/packetdrill/Makefile.Darwin
index 908b2770bf0f6f5b7448129ba1ffc9307251b33e..76955dbecea2d6397257ccc390e191ad9056ac27 100644
--- a/gtests/net/packetdrill/Makefile.Darwin
+++ b/gtests/net/packetdrill/Makefile.Darwin
@@ -1,5 +1,5 @@
 packetdrill-ext-libs := -lpcap
-CFLAGS = -D__APPLE_USE_RFC_3542
+CFLAGS = -D__APPLE_USE_RFC_3542 -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member
 LDFLAGS =
 ifneq ("$(wildcard /usr/lib/libsctp.dylib)","")
     packetdrill-ext-libs += -lsctp
diff --git a/gtests/net/packetdrill/Makefile.FreeBSD b/gtests/net/packetdrill/Makefile.FreeBSD
index 079bb0c2db3622ed1f20508af6a67d8cddad30ef..729edad2f092c0c99ce94a9261e86d58cf6ee301 100644
--- a/gtests/net/packetdrill/Makefile.FreeBSD
+++ b/gtests/net/packetdrill/Makefile.FreeBSD
@@ -1,2 +1,3 @@
 packetdrill-ext-libs := -lprocstat -lutil -lkvm -lelf -lpthread -lpcap
+CFLAGS = -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member
 .include "Makefile.common"
diff --git a/gtests/net/packetdrill/Makefile.Linux b/gtests/net/packetdrill/Makefile.Linux
index 2310254b23072b147f07406dfa06f444b1d0f57b..5cfef502937c94df4b2dbc59cb9045609af20ef1 100644
--- a/gtests/net/packetdrill/Makefile.Linux
+++ b/gtests/net/packetdrill/Makefile.Linux
@@ -1,2 +1,3 @@
 packetdrill-ext-libs := -lpthread -lrt -ldl -lsctp -static
+CFLAGS = -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member
 include Makefile.common
diff --git a/gtests/net/packetdrill/Makefile.NetBSD b/gtests/net/packetdrill/Makefile.NetBSD
index a32f8271bd55dc70076328c97c4a13986bac30fa..4898687cd28228f8847ad37b1314f7b11e322b64 100644
--- a/gtests/net/packetdrill/Makefile.NetBSD
+++ b/gtests/net/packetdrill/Makefile.NetBSD
@@ -1,2 +1,3 @@
 packetdrill-ext-libs := -lpthread -lpcap
+CFLAGS = -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member
 .include "Makefile.common"
diff --git a/gtests/net/packetdrill/Makefile.OpenBSD b/gtests/net/packetdrill/Makefile.OpenBSD
index a32f8271bd55dc70076328c97c4a13986bac30fa..4898687cd28228f8847ad37b1314f7b11e322b64 100644
--- a/gtests/net/packetdrill/Makefile.OpenBSD
+++ b/gtests/net/packetdrill/Makefile.OpenBSD
@@ -1,2 +1,3 @@
 packetdrill-ext-libs := -lpthread -lpcap
+CFLAGS = -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member
 .include "Makefile.common"
diff --git a/gtests/net/packetdrill/Makefile.common b/gtests/net/packetdrill/Makefile.common
index c019a4c336b03e6ca5fa016fdddf9d567bdabb11..ced71661d6eb927ad6967b0a7df1f31ec8b1d0fd 100644
--- a/gtests/net/packetdrill/Makefile.common
+++ b/gtests/net/packetdrill/Makefile.common
@@ -1,6 +1,6 @@
 all: binaries
 
-CFLAGS += -g -Wall -Werror -Wno-unknown-warning-option -Wno-address-of-packed-member
+CFLAGS += -g
 
 parser.o: parser.y
 	bison --output=parser.c --defines=parser.h --report=state parser.y
@@ -8,7 +8,7 @@ parser.o: parser.y
 
 lexer.o: lexer.l parser.o
 	flex -olexer.c lexer.l
-	$(CC) -O2 -g -Wall -Wno-unknown-warning-option -Wno-address-of-packed-member -c lexer.c
+	$(CC) -O2 $(CFLAGS) -c lexer.c
 
 packetdrill-lib := \
          checksum.o code.o config.o hash.o hash_map.o ip_address.o ip_prefix.o \