--- a/makesnortsam.sh
+++ b/makesnortsam.sh
@@ -36,8 +36,7 @@
 SSP_BSD_SRC="ssp_ipf.c ssp_ipfw2.c ssp_pf2.c"
 SSP_SUNOS_SRC="ssp_ipf.c"
 
-CFLAGS="-O2 -D${systype}"
-LDFLAGS=
+CFLAGS=" ${CFLAGS} -D${systype}"
 
 # OS specific flags
 LINUX_CFLAGS=
@@ -72,24 +71,24 @@
 
 		case "${systype}" in
 			Linux*)
-				gcc ${CFLAGS} ${LINUX_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
-					${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${LINUX_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
+					${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} -o ${SNORTSAM}
 				;;
 
 			OpenBSD*)
-				#gcc ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LIBS} /usr/lib/libnsl.a -o ${SNORTSAM}
-				gcc ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
-					${SSP_GENERIC_SRC} ${SSP_OBSD_SRC} -o ${SNORTSAM}
+				#${CC} ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LIBS} /usr/lib/libnsl.a -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
+					${SSP_GENERIC_SRC} ${SSP_OBSD_SRC} -o ${SNORTSAM}
 				;;
 
 			*BSD*)
-				gcc ${CFLAGS} ${BSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${BSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
-					${SSP_GENERIC_SRC} ${SSP_BSD_SRC} -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${BSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${BSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
+					${SSP_GENERIC_SRC} ${SSP_BSD_SRC} -o ${SNORTSAM}
 				;;
 
 			SunOS*)
-				gcc ${CFLAGS} ${SUNOS_CFLAGS} ${OPSEC_SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${OPSEC_SUNOS_LDFLAGS} \
-					${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC} -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${SUNOS_CFLAGS} ${OPSEC_SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${OPSEC_SUNOS_LDFLAGS} \
+					${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC} -o ${SNORTSAM}
 				;;
 		esac
 
@@ -104,24 +103,24 @@
 
 		case "${systype}" in
 			Linux*)
-				gcc ${CFLAGS} ${LINUX_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
-					${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${LINUX_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
+					${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} -o ${SNORTSAM}
 				;;
 
 			OpenBSD*)
-				#gcc ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LIBS} /usr/lib/libnsl.a -o ${SNORTSAM}
-				gcc ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
-					${SSP_GENERIC_SRC} ${SSP_OBSD_SRC} -o ${SNORTSAM}
+				#${CC} ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LIBS} /usr/lib/libnsl.a -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${OBSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
+					${SSP_GENERIC_SRC} ${SSP_OBSD_SRC} -o ${SNORTSAM}
 				;;
 
 			*BSD*)
-				gcc ${CFLAGS} ${BSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${BSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
-					${SSP_GENERIC_SRC} ${SSP_BSD_SRC} -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${BSD_CFLAGS} ${OPSEC_CFLAGS} ${LDFLAGS} ${BSD_LDFLAGS} ${OPSEC_LDFLAGS} ${OPSEC_LIBS} \
+					${SSP_GENERIC_SRC} ${SSP_BSD_SRC} -o ${SNORTSAM}
 				;;
 
 			SunOS*)
-				gcc ${CFLAGS} ${SUNOS_CFLAGS} ${OPSEC_SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${OPSEC_SUNOS_LDFLAGS} \
-					${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC} -o ${SNORTSAM}
+				${CC} ${CFLAGS} ${SUNOS_CFLAGS} ${OPSEC_SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${OPSEC_SUNOS_LDFLAGS} \
+					${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC} -o ${SNORTSAM}
 				;;
 		esac
 		cd ..
@@ -152,10 +151,10 @@
 		rm -f ${SAMTOOL}-debug
 
 		case "${systype}" in
-			Linux*)   gcc ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
-			OpenBSD*) gcc ${CFLAGS} ${OBSD_CFLAGS}  ${LDFLAGS} ${OBSD_LDFLAGS}  ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
-			*BSD*)    gcc ${CFLAGS} ${BSD_CFLAGS}   ${LDFLAGS} ${BSD_LDFLAGS}   ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
-			SunOS)    gcc ${CFLAGS} ${SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
+			Linux*)   echo ${CC} ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${LINUX_CFLAGS} ${LINUX_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
+			OpenBSD*) echo ${CC} ${CFLAGS} ${OBSD_CFLAGS}  ${LDFLAGS} ${OBSD_LDFLAGS}  ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${OBSD_CFLAGS} ${OBSD_LDFLAGS}  ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
+			*BSD*)    echo ${CC} ${CFLAGS} ${BSD_CFLAGS}   ${LDFLAGS} ${BSD_LDFLAGS}   ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${BSD_CFLAGS}  ${BSD_LDFLAGS}   ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
+			SunOS)    echo ${CC} ${CFLAGS} ${SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${SUNOS_CFLAGS} $${SUNOS_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
 		esac
 
 		echo "-------------------------------------------------------------------------------"
@@ -167,10 +166,10 @@
 		SAMTOOL="${SAMTOOL}-debug"
 
 		case "${systype}" in
-			Linux*)   gcc ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
-			OpenBSD*) gcc ${CFLAGS} ${OBSD_CFLAGS}  ${LDFLAGS} ${OBSD_LDFLAGS}  ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
-			*BSD*)    gcc ${CFLAGS} ${BSD_CFLAGS}   ${LDFLAGS} ${BSD_LDFLAGS}   ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
-			SunOS)    gcc ${CFLAGS} ${SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ;;
+			Linux*)   echo ${CC} ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${LINUX_CFLAGS} ${LINUX_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
+			OpenBSD*) echo ${CC} ${CFLAGS} ${OBSD_CFLAGS}  ${LDFLAGS} ${OBSD_LDFLAGS}  ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${OBSD_CFLAGS}  ${OBSD_LDFLAGS}  ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
+			*BSD*)    echo ${CC} ${CFLAGS} ${BSD_CFLAGS}   ${LDFLAGS} ${BSD_LDFLAGS}   ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${BSD_CFLAGS} ${BSD_LDFLAGS}   ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
+			SunOS)    echo ${CC} ${CFLAGS} ${SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; ${CC} ${CFLAGS} ${SUNOS_CFLAGS} ${SUNOS_LDFLAGS} ${SAMTOOL_SRC} -o ${SAMTOOL} ; [ $? = 0 ] || exit 1;;
 		esac
 		cd ..
 	;;
@@ -186,29 +185,12 @@
 		rm -f ${SNORTSAM}-debug
 
 		case "${systype}" in
-			Linux*)   gcc ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} -o ${SNORTSAM} ;;
-			OpenBSD*) gcc ${CFLAGS} ${OBSD_CFLAGS}  ${LDFLAGS} ${OBSD_LDFLAGS}  ${SSP_GENERIC_SRC} ${SSP_OBSD_SRC}  -o ${SNORTSAM} ;;
-			*BSD*)    gcc ${CFLAGS} ${BSD_CFLAGS}   ${LDFLAGS} ${BSD_LDFLAGS}   ${SSP_GENERIC_SRC} ${SSP_BSD_SRC}   -o ${SNORTSAM} ;;
-			SunOS*)   gcc ${CFLAGS} ${SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC} -o ${SNORTSAM} ;;
+			Linux*)   echo ${CC} ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} ${LDFLAGS} -o ${SNORTSAM} ; ${CC} ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} -o ${SNORTSAM} ; [ $? = 0 ] || exit 1;;
+			OpenBSD*) echo ${CC} ${CFLAGS} ${OBSD_CFLAGS} ${LDFLAGS} ${OBSD_LDFLAGS}  ${SSP_GENERIC_SRC} ${SSP_OBSD_SRC}  ${LDFLAGS} -o ${SNORTSAM} ; ${CC} ${CFLAGS} ${LDFLAGS} ${OBSD_CFLAGS} ${OBSD_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_OBSD_SRC} -o ${SNORTSAM} ; [ $? = 0 ] || exit 1;;
+			*BSD*)    echo ${CC} ${CFLAGS} ${BSD_CFLAGS} ${LDFLAGS} ${BSD_LDFLAGS}   ${SSP_GENERIC_SRC} ${SSP_BSD_SRC} -o ${SNORTSAM} ; ${CC} ${CFLAGS} ${LDFLAGS} ${BSD_CFLAGS} ${BSD_LDFLAGS}   ${SSP_GENERIC_SRC} ${SSP_BSD_SRC} -o ${SNORTSAM} ; [ $? = 0 ] || exit 1;;
+			SunOS*)   echo ${CC} ${CFLAGS} ${SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC}-o ${SNORTSAM} ; ${CC} ${CFLAGS} ${LDFLAGS} ${SUNOS_CFLAGS} ${SUNOS_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC} -o ${SNORTSAM} ; [ $? = 0 ] || exit 1;;
 		esac
 
-
-		echo "-------------------------------------------------------------------------------"
-		echo "Building SnortSam (debug)"
-		echo "-------------------------------------------------------------------------------"
-
-		rm -f *.o
-		CFLAGS="${CFLAGS} -DFWSAMDEBUG"
-		SNORTSAM="${SNORTSAM}-debug"
-
-		case "${systype}" in
-			Linux*)   gcc ${CFLAGS} ${LINUX_CFLAGS} ${LDFLAGS} ${LINUX_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_LINUX_SRC} -o ${SNORTSAM} ;;
-			OpenBSD*) gcc ${CFLAGS} ${OBSD_CFLAGS}  ${LDFLAGS} ${OBSD_LDFLAGS}  ${SSP_GENERIC_SRC} ${SSP_OBSD_SRC}  -o ${SNORTSAM} ;;
-			*BSD*)    gcc ${CFLAGS} ${BSD_CFLAGS}   ${LDFLAGS} ${BSD_LDFLAGS}   ${SSP_GENERIC_SRC} ${SSP_BSD_SRC}   -o ${SNORTSAM} ;;
-			SunOS*)   gcc ${CFLAGS} ${SUNOS_CFLAGS} ${LDFLAGS} ${SUNOS_LDFLAGS} ${SSP_GENERIC_SRC} ${SSP_SUNOS_SRC} -o ${SNORTSAM} ;;
-
-		esac
-		cd ..
 		;;
 esac
 
