diff --git a/src/Makefile b/src/Makefile
index ce4b569eebd7dcc94cfc8858daea7bf4f38dd287..0640b7d6fe8357492fd3527d2930c00b32c8aa7f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -383,7 +383,10 @@ else
 	WINDRESFLAGS = -DNDEBUG
 	CFLAGS+=-O3
 endif
-	CFLAGS+=-g $(OPTS) $(M5) $(WINDRESFLAGS)
+ifndef NODEBUG
+	CFLAGS+=-g
+endif
+	CFLAGS+=$(OPTS) $(M5) $(WINDRESFLAGS)
 
 ifdef YASM
 ifdef STABS
diff --git a/src/djgppdos/Makefile.cfg b/src/djgppdos/Makefile.cfg
index 857a7267bc88bfe08038b3c4bb7f575223997412..a5139b28e60b3e74871043eace74d1d34733e6a9 100644
--- a/src/djgppdos/Makefile.cfg
+++ b/src/djgppdos/Makefile.cfg
@@ -20,9 +20,9 @@ ifdef WATTCP
 endif
 
 #ifdef DEBUGMODE
-	LIBS=-lalld
+#	LIBS=-lalld
 #else
-#	LIBS=-lalleg
+	LIBS=-lalleg
 #endif
 
 ifndef NONET