xfstests: Clean up build output
[xfstests-dev.git] / Makefile
index e5d3d91d4f9bbf79c9f55c23a45234b0044460cc..a4bb63f47ed6d2cdb82e39059912f9503c7eb6ef 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,22 @@
 #
-# Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
-# 
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# 
-# Further, this software is distributed without any warranty that it is
-# free of the rightful claim of any third person regarding infringement
-# or the like.  Any license provided herein, whether implied or
-# otherwise, applies only to this software file.  Patent licenses, if
-# any, provided herein do not apply to combinations of this program with
-# other software, or any other product whatsoever.
-# 
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston MA 02111-1307, USA.
-# 
-# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
-# Mountain View, CA  94043, or:
-# 
-# http://www.sgi.com 
-# 
-# For further information regarding this notice, see: 
-# 
-# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+# Copyright (c) 2000-2008 Silicon Graphics, Inc.  All Rights Reserved.
 #
 
+ifeq ("$(origin V)", "command line")
+  BUILD_VERBOSE = $(V)
+endif
+ifndef BUILD_VERBOSE
+  BUILD_VERBOSE = 0
+endif
+
+ifeq ($(BUILD_VERBOSE),1)
+  Q =
+else
+  Q = @
+endif
+
+MAKEOPTS = --no-print-directory Q=$(Q)
+
 TOPDIR = .
 HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
 
@@ -38,33 +25,77 @@ include $(TOPDIR)/include/builddefs
 endif
 
 TESTS = $(shell sed -n -e '/^[0-9][0-9][0-9]*/s/ .*//p' group)
-CONFIGURE = configure include/builddefs
-LSRCFILES = configure configure.in
-LDIRT = *.bad *.new *.core *.full *.raw core a.out *.bak \
-       check.log check.time config.* conftest*
+CONFIGURE = configure include/builddefs include/config.h
+LSRCFILES = configure configure.in aclocal.m4 README VERSION
+LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
+       check.log check.time
+
+ifeq ($(HAVE_DMAPI), true)
+DMAPI_MAKEFILE = dmapi/Makefile
+endif
 
-SUBDIRS = include src
+LIB_SUBDIRS = include lib
+TOOL_SUBDIRS = ltp src m4
 
-default: $(CONFIGURE) new remake check $(TESTS)
+SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
+
+default: include/builddefs include/config.h $(DMAPI_MAKEFILE) new remake check $(TESTS)
 ifeq ($(HAVE_BUILDDEFS), no)
-       $(MAKE) -C . $@
+       $(Q)$(MAKE) $(MAKEOPTS) $@
 else
-       $(SUBDIRS_MAKERULE)
+       $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
+       # automake doesn't always support "default" target 
+       # so do dmapi make explicitly with "all"
+ifeq ($(HAVE_DMAPI), true)
+       $(Q)$(MAKE) $(MAKEOPTS) -C $(TOPDIR)/dmapi all
+endif
 endif
 
+# tool/lib dependencies
+src ltp: lib
+
 ifeq ($(HAVE_BUILDDEFS), yes)
 include $(BUILDRULES)
 else
 clean:  # if configure hasn't run, nothing to clean
 endif
 
-$(CONFIGURE): configure.in include/builddefs.in
-       rm -f config.cache
+configure include/builddefs:
+       autoheader
        autoconf
-       ./configure
+       ./configure \
+                --libexecdir=/usr/lib \
+                --enable-lib64=yes
+
+include/config.h: include/builddefs
+## Recover from the removal of $@
+       @if test -f $@; then :; else \
+               rm -f include/builddefs; \
+               $(MAKE) $(AM_MAKEFLAGS) include/builddefs; \
+       fi
+
+$(DMAPI_MAKEFILE):
+       cd $(TOPDIR)/dmapi/ ; ./configure
+
+aclocal.m4::
+       aclocal --acdir=`pwd`/m4 --output=$@
+
+install: default $(addsuffix -install,$(SUBDIRS))
+       $(INSTALL) -m 755 -d $(PKG_LIB_DIR)
+       $(INSTALL) -m 755 check $(PKG_LIB_DIR)
+       $(INSTALL) -m 755 [0-9]?? $(PKG_LIB_DIR)
+       $(INSTALL) -m 755 run.* $(PKG_LIB_DIR)
+       $(INSTALL) -m 644 group $(PKG_LIB_DIR)
+       $(INSTALL) -m 644 randomize.awk $(PKG_LIB_DIR)
+       $(INSTALL) -m 644 [0-9]??.* $(PKG_LIB_DIR)
+       $(INSTALL) -m 644 common* $(PKG_LIB_DIR)
+
+# Nothing.
+install-dev install-lib:
 
-install install-dev: default
-       $(SUBDIRS_MAKERULE)
+%-install:
+       $(MAKE) $(MAKEOPTS) -C $* install
 
 realclean distclean: clean
        rm -f $(LDIRT) $(CONFIGURE)
+       rm -rf autom4te.cache Logs