#
#  $Id: RULES_TOP,v 1.15 1998/06/02 21:00:10 jba Exp $
#

include $(TOP)/config/RULES_DIRS

uninstall$(DIVIDER)%::
	@$(RMDIR)  rec.bak rec
	@$(RMDIR) $(INSTALL_LOCATION_BIN)/$* $(INSTALL_LOCATION_LIB)/$* \
		$(INSTALL_DBD) $(INSTALL_MAN) $(INSTALL_INCLUDE) \
		$(INSTALL_HTML) $(INSTALL_JAVA) $(INSTALL_TEMPLATES)

uninstall:: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS))

tar:
	@DIRNAME=$(notdir $(shell pwd)); \
	echo "TOP: Creating $$DIRNAME.tar file..."; \
	ls Makefile* | xargs tar vcf $$DIRNAME.tar; \
	if [ -f .current_rel_hist ]; then \
		ls .current_rel_hist | xargs tar vrf $$DIRNAME.tar ; \
	fi ;\
	if [ -f EPICS_BASE ]; then \
		ls EPICS_BASE | xargs tar vrf $$DIRNAME.tar ; \
	fi ;\
	for DIR in ${DIRS}; do    \
		find $${DIR} -name CVS -prune -o ! -type d -print \
		| grep -v "/O\..*$$" | xargs tar vrf $$DIRNAME.tar; \
	done

help:
	@echo "Usage: gnumake [options] [target] ..."
	@echo "Targets supported by all Makefiles:"
	@echo "     install		- Installs executables in bin/<arch> (default rule)"
	@echo "     build		- Builds objects, using libraries from build_libs"
	@echo "     clean		- Cleans objects.  Clean removes the O.<arch> dirs"
	@echo "                   in all except the O.<arch> level Makefile"
	@echo "     depends		- Generates include dependencies"
	@echo "\"Partial\" build targets supported by Makefiles:"
	@echo "     install.<arch> - Builds and installs <arch> only."
	@echo "     clean.<arch>   - Cleans <arch> binaries in O.<arch> dirs only."
	@echo "     build.<arch>   - Builds <arch> only."
	@echo "     depends.<arch> - Generates <arch> dependencies only."
	@echo "Targets supported by top level Makefile:"
	@echo "     uninstall   - Cleans directories created by the install."
	@echo "     tar         - Create tar file "
	@echo "Indiv. object targets are supported by O.<arch> level Makefile .e.g"
	@echo "     xxxRecord.o"

.PHONY :: uninstall tar help
.PHONY :: $(addprefix uninstall$(DIVIDER), $(BUILDARCHS))

