.PHONY: all system-info help depend libs apps dist \
        install install-bin install-apps install-doc \
	uninstall uninstall-bin uninstall-apps uninstall-doc
.PHONY: libs
.PHONY: install-dvi uninstall-dvi

MAX_HOME = .
include $(MAX_HOME)/rules/init.mk

LIB_DIRS =	libxtoto 
APP_DIRS =	max 
SUB_DIRS =	$(LIB_DIRS) $(APP_DIRS)

all: libs apps

help:
	@(\
	echo "make help            prints this help-text";\
	echo "make system-info     prints system-identifier";\
	echo "make all             = make libs apps";\
	echo "make depend          sets up dependencies";\
	echo "make libs            creates the libraries";\
	echo "make apps            compiles the applications";\
	echo "make dist            tar and gzip everything to \$$TARGET_DIR";\
	echo "make install         = make install-bin install-doc";\
	echo "make install-bin     installs all binaries";\
	echo "make install-doc     installs documentation";\
	echo "make install-dvi     installs pretty documentation";\
	echo "make uninstall       = make uninstall-bin uninstall-doc";\
	echo "make uninstall-bin   removes all installed binaries"; \
	echo "make uninstall-doc   removes installed documentation";\
	echo "make uninstall-dvi   removes installed pretty documentation";\
	echo "make mostlyclean     deletes systems' programs and objects";\
	echo "make clean           deletes systems' binaries";\
	echo "make realclean       deletes all files created for this system";\
	echo "make distclean       deletes everything that can be remade";\
	)

system-info:
	@echo "$(SYSTEM)"

dist:
	rules/collect.sh \
	  --home=$(MAX_HOME) \
	  --version=$(VERSION) \
	  --target-dir=$(TARGET_DIR)

libs:
	for DIR in $(LIB_DIRS); do $(MAKE) -C $$DIR; done

apps:
	for DIR in $(APP_DIRS); do $(MAKE) -C $$DIR; done

include $(MAX_HOME)/rules/subdirs.mk
