
EPONYM = IvanHoe-Beta
VERSION_NUMBER = 999946a
VERSION = $(VERSION_NUMBER)-RobboLib

ALL = CHANGE_LOG COMRADES_HASH LARGE_PAGES UCI_OPTIONS Makefile

CD = cd
CP = /bin/cp
MKDIR = /bin/mkdir
RM = /bin/rm
TAR = /bin/tar
MV = /bin/mv
LN = /bin/ln
ALTRO_DIR = $(EPONYM)-$(VERSION)

all: IvanHoe RobboExplorative ComradesGUI RobboBaseLib RobboBuild RobboExplorer

IvanHoe::
	$(CD) IvanHoeSource && make && $(CD) ..
	$(LN) -fs IvanHoeSource/IvanHoe-GamePlay .
	$(LN) -fs IvanHoeSource/IvanHoe-Analysis .
RobboExplorative::
	$(CD) RobboExplorative-* && make && $(CD) ..
RobboExplorer::
	$(CD) RobboExplorerDir && make && $(CD) ..
	$(LN) -fs RobboExplorerDir/RobboExplorer .
ComradesGUI::
	$(CD) ComradesGUI-* && make && $(CD) ..
RobboBaseLib::
	$(CD) RobboBaseLib-* && make && $(CD) ..
	$(LN) -fs RobboBaseLib-*/RobboBaseLib.so . # entreat
RobboBuild::
	$(CD) RobboBuild && make && $(CD) ..

archive:
	$(RM) -rf $(ALTRO_DIR) # ensure
	$(MKDIR) $(ALTRO_DIR)
	$(MKDIR) $(ALTRO_DIR)/include
	$(CP) include/*.h $(ALTRO_DIR)/include
	$(CP) $(ALL) $(ALTRO_DIR)
	$(CD) IvanHoeSource && $(MAKE) archive && $(CD) ..
	$(CP) IvanHoeSource/IvanHoe*.tar $(ALTRO_DIR)
	$(TAR) -C $(ALTRO_DIR) -xf $(ALTRO_DIR)/IvanHoe*.tar
	$(CD) RobboExplorative-* && $(MAKE) archive && $(CD) ..
	$(CP) RobboExplorative-*/RobboExplorative*.tar $(ALTRO_DIR)
	$(TAR) -C $(ALTRO_DIR) -xf $(ALTRO_DIR)/RobboExplorative*.tar
	$(CD) ComradesGUI-* && $(MAKE) archive && $(CD) ..
	$(CP) ComradesGUI-*/ComradesGUI*.tar $(ALTRO_DIR)
	$(TAR) -C $(ALTRO_DIR) -xf $(ALTRO_DIR)/ComradesGUI*.tar
	$(CD) RobboBuild && $(MAKE) archive && $(CD) ..
	$(CP) RobboBuild/RobboBuild*.tar $(ALTRO_DIR)
	$(TAR) -C $(ALTRO_DIR) -xf $(ALTRO_DIR)/RobboBuild*.tar
	$(CD) RobboBaseLib-* && $(MAKE) archive && $(CD) ..
	$(CP) RobboBaseLib-*/RobboBaseLib*.tar $(ALTRO_DIR)
	$(TAR) -C $(ALTRO_DIR) -xf $(ALTRO_DIR)/RobboBaseLib**.tar
	$(CD) RobboExplorerDir && $(MAKE) archive && $(CD) ..
	$(CP) RobboExplorerDir/RobboExplorerSource.tar $(ALTRO_DIR)
	$(TAR) -C $(ALTRO_DIR) -xf $(ALTRO_DIR)/RobboExplorerSource.tar
	$(RM) $(ALTRO_DIR)/*.tar
	$(TAR) -cf ComradesTarBall-$(VERSION_NUMBER).tar $(ALTRO_DIR)/*
	$(RM) -rf $(ALTRO_DIR)
clean:
	$(CD) IvanHoeSource && make clean && $(CD) ..
	$(CD) RobboExplorative-* && make clean && $(CD) ..
	$(CD) ComradesGUI-* && make clean && $(CD) ..
	$(CD) RobboBuild && make clean && $(CD) ..
	$(CD) RobboBaseLib-* && make clean && $(CD) ..
	$(CD) RobboExplorerDir && make clean && $(CD) ..
	$(RM) -f RobboBaseLib.so RobboExplorer IvanHoe-GamePlay IvanHoe-Analysis