generic/192: fix instability on exFAT
[xfstests-dev.git] / Makefile
1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (C) 2000-2008, 2011 SGI  All Rights Reserved.
3 #
4 ifeq ("$(origin V)", "command line")
5   BUILD_VERBOSE = $(V)
6 endif
7 ifndef BUILD_VERBOSE
8   BUILD_VERBOSE = 0
9 endif
10
11 ifeq ($(BUILD_VERBOSE),1)
12   Q =
13 else
14   Q = @
15 endif
16
17 MAKEOPTS = --no-print-directory Q=$(Q)
18
19 TOPDIR = .
20 HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
21
22 ifeq ($(HAVE_BUILDDEFS), yes)
23 include $(TOPDIR)/include/builddefs
24 endif
25
26 SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
27
28 CONFIGURE = configure include/config.h include/config.h.in \
29             aclocal.m4 config.guess config.sub install-sh ltmain.sh \
30             m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
31             m4/lt~obsolete.m4
32 LSRCFILES = configure configure.ac aclocal.m4 README VERSION
33 LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
34         conftest* check.log check.time libtool include/builddefs
35
36 ifeq ($(HAVE_BUILDDEFS), yes)
37 LDIRT += $(SRCTAR)
38 endif
39
40 LIB_SUBDIRS = include lib
41 TOOL_SUBDIRS = ltp src m4 common
42
43 export TESTS_DIR = tests
44 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR)
45
46 default: include/builddefs
47 ifeq ($(HAVE_BUILDDEFS), no)
48         $(Q)$(MAKE) $(MAKEOPTS) $@
49 else
50         $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
51 endif
52
53 # tool/lib dependencies
54 $(TOOL_SUBDIRS): $(LIB_SUBDIRS)
55
56 ifeq ($(HAVE_BUILDDEFS), yes)
57 include $(BUILDRULES)
58 else
59 clean:  # if configure hasn't run, nothing to clean
60 endif
61
62 configure: configure.ac
63         libtoolize -cfi
64         cp include/install-sh .
65         aclocal -I m4
66         autoheader
67         autoconf
68
69 include/builddefs include/config.h: configure
70         ./configure \
71                 --libexecdir=/usr/lib \
72                 --exec_prefix=/var/lib
73
74 aclocal.m4::
75         aclocal --acdir=`pwd`/m4 --output=$@
76
77 depend: include/builddefs $(addsuffix -depend,$(SUBDIRS))
78
79 install: default $(addsuffix -install,$(SUBDIRS))
80         $(INSTALL) -m 755 -d $(PKG_LIB_DIR)
81         $(INSTALL) -m 755 check $(PKG_LIB_DIR)
82         $(INSTALL) -m 644 randomize.awk $(PKG_LIB_DIR)
83
84 # Nothing.
85 install-dev install-lib:
86
87 %-install:
88         $(MAKE) $(MAKEOPTS) -C $* install
89
90 realclean distclean: clean
91         $(Q)rm -f $(LDIRT) $(CONFIGURE)
92         $(Q)rm -rf autom4te.cache Logs
93
94 dist: include/builddefs include/config.h default
95 ifeq ($(HAVE_BUILDDEFS), no)
96         $(Q)$(MAKE) $(MAKEOPTS) -C . $@
97 else
98         $(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
99 endif
100
101 $(SRCTAR) : default
102         $(Q)git archive --prefix=$(PKG_NAME)-$(PKG_VERSION)/ --format=tar \
103           v$(PKG_VERSION) > $(PKG_NAME)-$(PKG_VERSION).tar
104         $(Q)$(TAR) --transform "s,^,$(PKG_NAME)-$(PKG_VERSION)/," \
105           -rf $(PKG_NAME)-$(PKG_VERSION).tar $(CONFIGURE)
106         $(Q)$(ZIP) $(PKG_NAME)-$(PKG_VERSION).tar
107         echo Wrote: $@