xfstests: fix depend targets
[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 include/config.h $(DMAPI_MAKEFILE) new remake check $(TESTS)
43 ifeq ($(HAVE_BUILDDEFS), no)
44         $(Q)$(MAKE) $(MAKEOPTS) $@
45 else
46         $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
47         # automake doesn't always support "default" target 
48         # so do dmapi make explicitly with "all"
49 ifeq ($(HAVE_DMAPI), true)
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 include/builddefs:
64         autoheader
65         autoconf
66         ./configure \
67                 --libexecdir=/usr/lib \
68                 --enable-lib64=yes
69
70 include/config.h: include/builddefs
71 ## Recover from the removal of $@
72         @if test -f $@; then :; else \
73                 rm -f include/builddefs; \
74                 $(MAKE) $(AM_MAKEFLAGS) include/builddefs; \
75         fi
76
77 $(DMAPI_MAKEFILE):
78         cd $(TOPDIR)/dmapi/ ; ./configure
79
80 aclocal.m4::
81         aclocal --acdir=`pwd`/m4 --output=$@
82
83 install: default $(addsuffix -install,$(SUBDIRS))
84         $(INSTALL) -m 755 -d $(PKG_LIB_DIR)
85         $(INSTALL) -m 755 check $(PKG_LIB_DIR)
86         $(INSTALL) -m 755 [0-9]?? $(PKG_LIB_DIR)
87         $(INSTALL) -m 755 run.* $(PKG_LIB_DIR)
88         $(INSTALL) -m 644 group $(PKG_LIB_DIR)
89         $(INSTALL) -m 644 randomize.awk $(PKG_LIB_DIR)
90         $(INSTALL) -m 644 [0-9]??.* $(PKG_LIB_DIR)
91         $(INSTALL) -m 644 common* $(PKG_LIB_DIR)
92
93 # Nothing.
94 install-dev install-lib:
95
96 %-install:
97         $(MAKE) $(MAKEOPTS) -C $* install
98
99 realclean distclean: clean
100         rm -f $(LDIRT) $(CONFIGURE)
101         rm -rf autom4te.cache Logs