049638a03fb506ee6412cb0e44d900bb74bfa1ee
hiram
  Wed Oct 16 13:35:03 2013 -0700
fixup slow behavior in make clean with new mysql_config business refs #11899 #9149
diff --git src/inc/common.mk src/inc/common.mk
index 443e474..f4776cb 100644
--- src/inc/common.mk
+++ src/inc/common.mk
@@ -67,30 +67,32 @@
 ifeq (${PNGLIB},)
   ifneq ($(wildcard /opt/local/lib/libpng.a),)
       PNGLIB=/opt/local/lib/libpng.a
   endif
 endif
 ifeq (${PNGLIB},)
   PNGLIB=-lpng
 endif
 ifeq (${PNGINCL},)
   ifneq ($(wildcard /opt/local/include/png.h),)
       PNGINCL=-I/opt/local/include
   endif
 endif
 
 # autodetect where mysql includes and libraries are installed
+# do not need to do this during 'clean' target (this is very slow for 'clean')
+ifneq ($(MAKECMDGOALS),clean)
   ifeq (${MYSQLINC},)
       MYSQLINC := $(shell mysql_config --include | sed -e 's/-I//' || true)
     #  $(info using mysql_config to set MYSQLINC: ${MYSQLINC})
   endif
   ifeq (${MYSQLLIBS},)
       MYSQLLIBS := $(shell mysql_config --libs || true)
     #  $(info using mysql_config to set MYSQLLIBS: ${MYSQLLIBS})
   endif
 
   ifeq (${MYSQLINC},)
     ifneq ($(wildcard /usr/local/mysql/include/mysql.h),)
 	  MYSQLINC=/usr/local/mysql/include
     endif
   endif
   ifeq (${MYSQLINC},)
@@ -130,30 +132,31 @@
   endif
   ifeq (${MYSQLLIBS},)
     ifneq ($(wildcard /opt/local/lib/mysql55/mysql/libmysqlclient.a),)
 	  MYSQLLIBS=/opt/local/lib/mysql55/mysql/libmysqlclient.a
     endif
   endif
   ifeq ($(findstring src/hg/,${CURDIR}),src/hg/)
       ifeq (${MYSQLINC},)
 	$(error can not find installed mysql development system)
     endif
   endif
     # last resort, hoping the compiler can find it in standard locations
   ifeq (${MYSQLLIBS},)
       MYSQLLIBS="-lmysqlclient"
   endif
+endif
 
 # $(info have MYSQLINC: ${MYSQLINC})
 # $(info have MYSQLLIBS: ${MYSQLLIBS})
 
 UNAME_S := $(shell uname -s)
 
 # OK to add -lstdc++ to all MYSQLLIBS just in case it is
 #    MySQL version 5.6 libraries, but no 'librt' on Mac OSX
 ifeq ($(UNAME_S),Darwin)
   MYSQLLIBS += -lstdc++
 else
   MYSQLLIBS += -lstdc++ -lrt
 endif
 
 L+=${PNGLIB}