CC=gcc
CFLAGS=-O2 -Wall -mcpu=pentium

all:    subdirs
	if [ ! -d bin ]; then mkdir bin; fi; \
	cd bin/ && for f in `find .. -type f -and \( -name "*.pl" -or -name "*.sh" \)`; do \
	       	  chmod +x $$f ;                    \
	       	  ln -sf $$f ;		      \
        done
	if [ ! -d lib ]; then mkdir lib; fi
	cd lib && for f in `find .. -type f -and -name "*.pm"`; do \
               ln -sf $${f} ;                        \
        done
	cd bin && ln -sf ../chimera/ucs ucs
	cd bin && for f in `find ../unigene/Kp -type f -perm -0111`; do  \
		ln -sf $${f} ;						 \
	done

subdirs:
	$(MAKE) -C chimera
	$(MAKE) -C unigene/Kp
	$(MAKE) -C bac/validate_submission

#make symlinks in /usr/local/bin. need root privileges for this
install: subdirs
	if [ `whoami` = 'root' ]; then \
	      for f in `find $$PWD -type f -and \( -name "*.pl" -or -name "*.sh" \)`; do \
	       	  chmod +x $${f} ;                    \
	       	  ln -sf $${f} /usr/local/bin ;		      \
	      done \
	else \
	  echo ERROR: must be root to make install ;\
	fi
