##
##  Makefile
##

# ------------------------------------------------
#   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=

INITVARS = \
    have_getoptlong=@have_getoptlong@; \
    have_bitvector=@have_bitvector@; \
    have_io=@have_io@

SUBDIRS = \
    getoptlong \
    bitvector \
    io

# ------------------------------------------------
#   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 "===> lib/$$dir"; \
	        test -f $$dir/Makefile || \
	            (cd $$dir && $(PATH_PERL) Makefile.PL $(MM_INSTALL_OPTS)); \
	        (cd $$dir && $(MAKE) $(PERL_OPTS) pure_all) \
	        || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	        echo "<=== lib/$$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 "===> lib/$$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 "<=== lib/$$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 "===> lib/$$dir"; \
	        if [ -f $$dir/Makefile ]; then \
	            (cd $$dir && $(MAKE) clean); \
	            mv $$dir/Makefile.old $$dir/Makefile 2>/dev/null; \
	        else :; \
	        fi; \
	        echo "<=== lib/$$dir"; \
	    else :; \
	    fi; \
	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 "===> lib/$$dir"; \
	        if [ -f $$dir/Makefile ]; then \
	            (cd $$dir && $(MAKE) realclean); \
	            rm -f $$dir/Makefile 2>/dev/null; \
	        else :; \
	        fi; \
	        echo "<=== lib/$$dir"; \
	    else :; \
	    fi; \
	done
	-rm -f Makefile

realclean: distclean

##EOF##
