diff --git a/build/platforms/Makefile b/build/platforms/Makefile
index 31a7db605420ba735845c8fd70c93865de62fe62..5cd6cecc90f0befb2ad8550ad80f62dc4757bd0d 100644
--- a/build/platforms/Makefile
+++ b/build/platforms/Makefile
@@ -27,7 +27,7 @@ install:	FORCE
 clean:	FORCE
 	@echo "making clean in `pwd`"
 	@for i in *; do \
-	    if [ -d $$i -a $$i != "CVS" ]; then \
+	    if [ -d $$i -a $$i != "CVS" -a -f $$i/Makefile ]; then \
 		echo; echo "  cd $$i; $(MAKE) $(MFLAGS) clean"; \
 		( cd $$i; $(MAKE) $(MFLAGS) clean ); \
 	    fi; \
@@ -36,7 +36,7 @@ clean:	FORCE
 veryclean:	FORCE
 	@echo "making veryclean in `pwd`"
 	@for i in *; do \
-	    if [ -d $$i -a -f $$i/Makefile ]; then \
+	    if [ -d $$i -a $$i != "CVS" -a -f $$i/Makefile ]; then \
 		echo; echo "  cd $$i; $(MAKE) $(MFLAGS) veryclean"; \
 		( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
 	    fi; \
diff --git a/build/platforms/freebsd-gcc/Make-platform b/build/platforms/freebsd-gcc/Make-platform
index 6df57c5be5ce68adf6ae242a4e452fb1a2e7c808..e62892a9511b3e1ff57cb948389d482f098762f3 100644
--- a/build/platforms/freebsd-gcc/Make-platform
+++ b/build/platforms/freebsd-gcc/Make-platform
@@ -9,7 +9,7 @@
 PREFIX?=/usr/local
 INSTROOT=${PREFIX}
 ETCDIR= $(INSTROOT)/etc/ldap
-EXTRACFLAGS=-O -DLDAP_DEBUG
+EXTRACFLAGS=-O
 LDBMBACKEND=-DLDBM_USE_DBBTREE
 LDBMINCLUDE=-I/usr/include
 #
@@ -21,18 +21,18 @@ LDBMINCLUDE=-I/usr/include
 # This means that the implicit-yield threading is topologically
 # equivalent to preemptive threading.
 #
-THREADS= -D_THREAD_SAFE -DPOSIX_THREADS -DPTHREAD_PREEMPTIVE
+THREADS= -DPOSIX_THREADS -D_THREAD_SAFE -DPTHREAD_PREEMPTIVE
+
+# use special gcc flag to include libc_r.a
 THREADSLIB= -pthread
 #THREADSLIB= -lc_r
 
-# we need to link in the V3 library to get sigset()
-PLATFORMLIBS= -lcrypt
+# crypt(3) is in a separate library
+LDAP_CRYPT_LIB= -lcrypt
 
 #
 # -------------------------------------------------------------------------
 # you will probably not need to edit anything below this point
 # -------------------------------------------------------------------------
 CC	= gcc
-
 PLATFORMCFLAGS=	-Dfreebsd
-
diff --git a/build/platforms/linux-gcc/Make-platform b/build/platforms/linux-gcc/Make-platform
index 2699aac6f12fc5a5ae4d6a262f51c4df8b1ee2fe..251ff4ea9565baf5cffb5f63ebc45a8fce6463ef 100644
--- a/build/platforms/linux-gcc/Make-platform
+++ b/build/platforms/linux-gcc/Make-platform
@@ -6,6 +6,9 @@
 # add any platform-specific overrides below here
 #
 
+# crypt(3) is in -lcrypt
+LDAP_CRYPT_LIB= -lcrypt
+
 
 #
 # -------------------------------------------------------------------------