##
##  wml_common/Makefile
##  Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved. 
##

# ------------------------------------------------
#   DEFINITIONS
# ------------------------------------------------

@SET_MAKE@
SHELL = /bin/sh

top_srcdir      = @top_srcdir@
srcdir          = @srcdir@
VPATH           = @srcdir@

INSTALL_PROGRAM = $(top_srcdir)/etc/shtool install -c -m 755 -s
INSTALL_DATA    = $(top_srcdir)/etc/shtool install -c -m 644

prefix          = @prefix@
exec_prefix     = $(prefix)
bindir          = $(prefix)/bin
libsubdir       = @libsubdir@
libdir          = $(prefix)/lib$(libsubdir)
mandir          = $(prefix)/man

PATH_PERL       = @PATH_PERL@
MM_INSTALL_OPTS = PREFIX=$(libdir)/perl \
                  INSTALLPRIVLIB=@INSTALLPRIVLIB@ \
                  INSTALLARCHLIB=@INSTALLARCHLIB@ \
                  INST_MAN1DIR= \
                  INSTALLMAN1DIR= \
                  INST_MAN3DIR= \
                  INSTALLMAN3DIR=
PERL_OPTS       = @PERL_OPTS@

INITVARS = \
     have_getoptlong=@have_getoptlong@ \
     have_bitvector=@have_bitvector@ \
     have_filepathconvert=@have_filepathconvert@ \
     have_imagesize=@have_imagesize@ \
     have_io=@have_io@ \
     have_termreadkey=@have_termreadkey@ \
     have_htmlclean=0 \
     have_gd=0

SUBDIRS = \
     bitvector \
     filepathconvert \
     gd \
     getoptlong \
     htmlclean \
     imagesize \
     io \
     termreadkey

# ------------------------------------------------
#   TARGETS
# ------------------------------------------------

all:
	@set -e; \
	set dummy $(MAKEFLAGS); amf=$$2; \
	$(INITVARS); \
	for dir in $(SUBDIRS); do \
	    eval "update=\"`echo '$$'have_$$dir`\""; \
	    if test ".$$update" = .0; then \
	        echo "===> wml_common/$$dir ($@)"; \
	        if [ -f $$dir/Makefile ]; then \
	            :; \
	        else \
	            (cd $$dir && $(PATH_PERL) Makefile.PL $(MM_INSTALL_OPTS)); \
	        fi; \
	        (cd $$dir && $(MAKE) $(PERL_OPTS) pure_all) \
	        || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	        echo "<=== wml_common/$$dir"; \
	    else :; \
	    fi; \
	done && test -z "$$fail"

install:
	@set -e; \
	set dummy $(MAKEFLAGS); amf=$$2; \
	$(INITVARS); \
	for dir in $(SUBDIRS); do \
	    eval "update=\"`echo '$$'have_$$dir`\""; \
	    if test ".$$update" = .0; then \
	        echo "===> wml_common/$$dir ($@)"; \
	        (cd $$dir && $(MAKE) pure_perl_install $(MM_INSTALL_OPTS) 2>&1 | sed -e '/^## Diff/,/^## Runn/d') \
	        || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	        echo "<=== wml_common/$$dir"; \
	    else :; \
	    fi; \
	done && test -z "$$fail"

clean:
	-@$(INITVARS); \
	for dir in $(SUBDIRS); do \
	    eval "update=\"`echo '$$'have_$$dir`\""; \
	    if test ".$$update" = .0; then \
	        echo "===> wml_common/$$dir ($@)"; \
	        if [ -f $$dir/Makefile ]; then \
	            (cd $$dir && $(MAKE) clean); \
	        fi; \
	        echo "<=== wml_common/$$dir"; \
	    else :; \
	    fi; \
	    rm -f $$dir/Makefile.old 2>/dev/null; \
	done

#  The distclean target in the Makefile generated by ExtUtils::MakeMaker 
#  performs a check to see if files are all listed in the MANIFEST file.
#  An error is reported because of CVS files, it's why the realclean
#  target is used instead.

distclean: clean
	-@$(INITVARS); \
	for dir in $(SUBDIRS); do \
	    eval "update=\"`echo '$$'have_$$dir`\""; \
	    if test ".$$update" = .0; then \
	        echo "===> wml_common/$$dir ($@)"; \
	        (cd $$dir && $(PATH_PERL) Makefile.PL && $(MAKE) realclean); \
	        echo "<=== wml_common/$$dir"; \
	    else :; \
	    fi; \
	done
	-rm -f Makefile

realclean: distclean

##EOF##
