#####################################################
# Top-level makefile for XMGR4                      #
#####################################################
# You should not change anything here.              #
# Please read INSTALL file in the current directory #
#####################################################

###############################
#
TOP = .
###############################

include $(TOP)/Make.arch

include $(TOP)/Make.conf

###############################
# Directory containing source code
#
SRCDIR=$(TOP)/src
###############################

###############################
# Directory containing documentation
#
DOCDIR=$(TOP)/doc
###############################

###############################
# Directory containing test examples
#
TESTDIR=$(TOP)/examples
###############################


###############################
# Location of the xmgr executable
#
XMGRBIN = $(XMGRDIR)/bin
###############################

###############################
# Location of the xmgr documentation
#
XMGRHELP = $(XMGRDIR)/doc
###############################

###############################
# Location of the xmgr examples
#
XMGREXAMPLES = $(XMGRDIR)/examples
###############################

ifeq "$(USE_GUI)" "no"
ACEGR = gr
else
ACEGR = xmgr
endif

all: Make.arch
	@cd $(SRCDIR) ; $(MAKE)
	
test:
	@cd $(TESTDIR) ; ./dotest
		
install:
	mkdir -p $(XMGRBIN)
	$(INSTALL) -s -m 755 $(SRCDIR)/$(ACEGR) $(XMGRBIN)
	$(INSTALL) -c -m 644 $(SRCDIR)/XMgr.ad $(APPDEFAULTS)

links:
	ln -sf $(XMGRBIN)/$(ACEGR) $(BINPATH)/$(ACEGR)
	ln -sf $(XMGRBIN)/$(ACEGR) $(BINPATH)/grbatch

install.doc:
	/bin/rm -rf $(XMGRHELP)
	mkdir -p $(XMGRHELP)
	$(INSTALL) -c -m 644 $(DOCDIR)/* $(XMGRHELP)
	
install.examples:
	/bin/rm -rf $(XMGREXAMPLES)
	mkdir -p $(XMGREXAMPLES)
	$(INSTALL) -c -m 644 $(TESTDIR)/* $(XMGREXAMPLES)

Make.arch:
	@echo
	@echo Please read INSTALL file in the current directory
	@echo
	@exit 1

clean:
	@cd $(SRCDIR); $(MAKE) clean

distclean:
	@cd $(SRCDIR); $(MAKE) distclean
	rm -f Make.arch
