#PG SRCDIRS  = app src bin
SRCDIRS  = tools sg app src bin
SUBDIRS  = $(SRCDIRS) lib
TARGETS  = default depend

default:

#PG
install:
	@pwd=`pwd`; instdir=$$HOME/lib/`basename $$pwd`; \
	echo "Installation directory [$$instdir]: " |\
	awk '{printf("%s",$$0)}'; read answer; \
	if [ "$$answer" ]; then instdir=$$answer; fi; \
	if [ -d $$instdir ]; then \
	  echo "$$instdir exists. Remove and recreate [n]? " |\
	  awk '{printf("%s",$$0)}'; read answer; \
	  if [ "$$answer" != "y" ]; then \
	    echo "Installation not started."; exit; \
	  fi; \
	fi; \
	rm -rf $$instdir; mkdir -p $$instdir; \
	if [ ! -d $$instdir ]; then \
	  echo "Cannot create $$instdir."; exit; \
	fi; \
	bin/apcpdoc $$instdir; \
	cp src/main/autopsy $$instdir/autopsy.exe; \
	cd $$instdir; ./INSTALL

$(TARGETS):
	$(MAKE) $(SRCDIRS) TARGET=$@
	
clean:
	$(MAKE) $(SUBDIRS) TARGET=$@
	find */* -name makedep -exec cp /dev/null {} \;
	rm -f dump par history

$(SUBDIRS): FORCE
	cd $@; $(MAKE) $(TARGET)

FORCE:
