xfstests: a few fixes to Makefile
[xfstests-dev.git] / Makefile
1 #
2 # Copyright (c) 2000-2008 Silicon Graphics, Inc.  All Rights Reserved.
3 #
4
5 ifeq ("$(origin V)", "command line")
6   BUILD_VERBOSE = $(V)
7 endif
8 ifndef BUILD_VERBOSE
9   BUILD_VERBOSE = 0
10 endif
11
12 ifeq ($(BUILD_VERBOSE),1)
13   Q =
14 else
15   Q = @
16 endif
17
18 MAKEOPTS = --no-print-directory Q=$(Q)
19
20 TOPDIR = .
21 HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
22
23 ifeq ($(HAVE_BUILDDEFS), yes)
24 include $(TOPDIR)/include/builddefs
25 endif
26
27 TESTS = $(shell sed -n -e '/^[0-9][0-9][0-9]*/s/ .*//p' group)
28 CONFIGURE = configure include/builddefs include/config.h
29 LSRCFILES = configure configure.in aclocal.m4 README VERSION
30 LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
31         conftest* check.log check.time
32
33 ifeq ($(HAVE_DMAPI), true)
34 DMAPI_MAKEFILE = dmapi/Makefile
35 endif
36
37 LIB_SUBDIRS = include lib
38 TOOL_SUBDIRS = ltp src m4
39
40 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
41
42 default: include/builddefs $(DMAPI_MAKEFILE) $(TESTS)
43 ifeq ($(HAVE_BUILDDEFS), no)
44         $(Q)$(MAKE) $(MAKEOPTS) $@
45 else
46         $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
47 ifeq ($(HAVE_DMAPI), true)
48         # automake doesn't always support "default" target 
49         # so do dmapi make explicitly with "all"
50         $(Q)$(MAKE) $(MAKEOPTS) -C $(TOPDIR)/dmapi all
51 endif
52 endif
53
54 # tool/lib dependencies
55 src ltp: lib
56
57 ifeq ($(HAVE_BUILDDEFS), yes)
58 include $(BUILDRULES)
59 else
60 clean:  # if configure hasn't run, nothing to clean
61 endif
62
63 configure: configure.in
64         autoheader
65         autoconf
66
67 include/builddefs include/config.h: configure
68         ./configure \
69                 --libexecdir=/usr/lib \
70                 --enable-lib64=yes
71
72 ifeq ($(HAVE_DMAPI), true)
73 $(DMAPI_MAKEFILE):
74         $(Q)cd $(TOPDIR)/dmapi && ./configure
75 endif
76
77 aclocal.m4::
78         aclocal --acdir=`pwd`/m4 --output=$@
79
80 install: default $(addsuffix -install,$(SUBDIRS))
81         $(INSTALL) -m 755 -d $(PKG_LIB_DIR)
82         $(INSTALL) -m 755 check $(PKG_LIB_DIR)
83         $(INSTALL) -m 755 [0-9]?? $(PKG_LIB_DIR)
84         $(INSTALL) -m 755 run.* $(PKG_LIB_DIR)
85         $(INSTALL) -m 644 group $(PKG_LIB_DIR)
86         $(INSTALL) -m 644 randomize.awk $(PKG_LIB_DIR)
87         $(INSTALL) -m 644 [0-9]??.* $(PKG_LIB_DIR)
88         $(INSTALL) -m 644 common* $(PKG_LIB_DIR)
89
90 # Nothing.
91 install-dev install-lib:
92
93 %-install:
94         $(MAKE) $(MAKEOPTS) -C $* install
95
96 realclean distclean: clean
97         $(Q)rm -f $(LDIRT) $(CONFIGURE)
98         $(Q)rm -rf autom4te.cache Logs