# These are some standard rules common to all subdirectory Makefiles.

include $(srcdir)/BINFILES
include $(srcdir)/SRCFILES
include $(srcdir)/MISCFILES

mkinstalldirs = $(top_srcdir)/mkinstalldirs
MOVEIFCHANGE = $(top_srcdir)/move-if-change

default: all

all: all-here all-recursive

bakclean:
	rm -f *~ *#
	rm -f *.orig *.rej

clean:
	rm -f *.o $(lib_name_prefix)*$(lib_name_extender) *.tmp
	rm -f core report nohup.out errlog
	rm -f foobar foo bar baz junk schrott muell

filecheck: filecheck-here filecheck-recursive

filecheck-here:
	$(top_srcdir)/checkfiles

install: all-here install-include install-lib install-man \
install-recursive

uninstall: uninstall-recursive uninstall-include uninstall-lib uninstall-man

ifdef dont_install_libs
install-lib:

else
install-lib:
	$(mkinstalldirs) $(libdir)
	@list='$(LIBS)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo " $(INSTALL) -m 644 $$p $(libdir)"; \
	    $(INSTALL) -m 644 $$p $(libdir); \
	  else :; fi; \
	done

uninstall-lib:
	@list='$(LIBS)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo " rm -f $(libdir)/$$p"; \
	    rm -f $(libdir)/$$p; \
	  else :; fi; \
	done

endif

DISTFILES = $(MISCFILES) $(SRCFILES)

distdir = $(top_builddir)/MiNTLib-$(VERSION)/$(subdir)

distdir: $(DISTFILES) distdir-local
	@for file in $(DISTFILES); do \
	  d=$(srcdir); \
	  test -d $$d/$$file \
	  || test -f $(distdir)/$$file \
	  || ln $$d/$$file $(distdir)/$$file 2>/dev/null \
	  || cp -p $$d/$$file $(distdir)/$$file \
	  || exit 1; \
	done
	for subdir in $(SUBDIRS); do \
	  test -d $(distdir)/$$subdir \
	  || mkdir $(distdir)/$$subdir \
	  || exit 1; \
	  chmod 777 $(distdir)/$$subdir; \
	  (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
	    || exit 1; \
	done

distdir-local:

all-recursive clean-recursive bakclean-recursive filecheck-recursive \
install-recursive uninstall-recursive install-lib-recursive \
install-include-recursive install-man-recursive uninstall-lib-recursive \
uninstall-include-recursive uninstall-man-recursive dist-recursive:
	@set fnord $(MAKEFLAGS); amf=$$2; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  target=`echo $@ | sed s/-recursive//`; \
	  echo "Making $$target in $$subdir"; \
	  (cd $$subdir && $(MAKE) -r $$target) \
	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
	done && test -z "$$fail"

