#
# Makefile for examples subdirectory
#
# September 97: new examples image, xlib_rubik, mandel (this only for
#               multithreaded X libraries)
# 9 Feb 2002 H.-F. Vogt: new example program show_printers
#

include ../Local.conf

SUBDIRS = actions xmmore clock display_info hello_world image \
          rotate_arrow testpath \
          show_extensions show_hosts show_screen_saver xlib_rubik xau_test
XPM_SUBDIRS = dig_clock xpminfo
R6_SUBDIRS  = mandel
R63_SUBDIRS  = mandel show_printers
MOTIF20_SUBDIRS = i18n

ALL_SUBDIRS = $(SUBDIRS) $(XPM_SUBDIRS) $(R63_SUBDIRS) $(R6_SUBDIRS) $(MOTIF20_SUBDIRS)


all: ladyada_xpm.ads
	for i in $(SUBDIRS) ;\
	do \
		(cd $$i; make all); \
	done
	if test -n "$(HAS_XPM)" ; \
	then \
		for i in $(XPM_SUBDIRS) ;\
		do \
			(cd $$i; make all); \
		done \
	fi
	if test -n "$(IS_X11R63)" ; \
	then \
		for i in $(R63_SUBDIRS) ;\
		do \
			(cd $$i; make all); \
		done \
	fi
	if test -n "$(IS_X11R6)" ; \
	then \
		for i in $(R6_SUBDIRS) ;\
		do \
			(cd $$i; make all); \
		done \
	fi
	if test -n "$(IS_MOTIF20)" ; \
	then \
		for i in $(MOTIF20_SUBDIRS) ;\
		do \
			(cd $$i; make all); \
		done \
	fi

ladyada_xpm.ads: ../utils/xpm2axpm ../ladyada.xpm
	if test -n "$(HAS_XPM)" ; \
	then \
		$(RM) ladyada_xpm.ads ; \
		../utils/xpm2axpm ../ladyada.xpm > ladyada_xpm.ads ; \
	else \
		touch ladyada_xpm.ads ; \
	fi

clean:
	for i in $(ALL_SUBDIRS) ;\
	do \
		(cd $$i; make clean); \
	done

distclean:
	for i in $(ALL_SUBDIRS) ;\
	do \
		(cd $$i; make distclean); \
	done
