overlay/07[01]: use existing char/block devices
[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 ifeq ($(HAVE_DMAPI), true)
43 TOOL_SUBDIRS += dmapi
44 endif
45
46 export TESTS_DIR = tests
47 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR)
48
49 default: include/builddefs $(DMAPI_MAKEFILE)
50 ifeq ($(HAVE_BUILDDEFS), no)
51         $(Q)$(MAKE) $(MAKEOPTS) $@
52 else
53         $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
54 endif
55
56 # tool/lib dependencies
57 $(TOOL_SUBDIRS): $(LIB_SUBDIRS)
58
59 ifeq ($(HAVE_BUILDDEFS), yes)
60 include $(BUILDRULES)
61 else
62 clean:  # if configure hasn't run, nothing to clean
63 endif
64
65 configure: configure.ac
66         libtoolize -cfi
67         cp include/install-sh .
68         aclocal -I m4
69         autoheader
70         autoconf
71
72 include/builddefs include/config.h: configure
73         ./configure \
74                 --libexecdir=/usr/lib \
75                 --exec_prefix=/var/lib
76
77 aclocal.m4::
78         aclocal --acdir=`pwd`/m4 --output=$@
79
80 depend: include/builddefs $(addsuffix -depend,$(SUBDIRS))
81
82 install: default $(addsuffix -install,$(SUBDIRS))
83         $(INSTALL) -m 755 -d $(PKG_LIB_DIR)
84         $(INSTALL) -m 755 check $(PKG_LIB_DIR)
85         $(INSTALL) -m 644 randomize.awk $(PKG_LIB_DIR)
86
87 # Nothing.
88 install-dev install-lib:
89
90 %-install:
91         $(MAKE) $(MAKEOPTS) -C $* install
92
93 realclean distclean: clean
94         $(Q)rm -f $(LDIRT) $(CONFIGURE)
95         $(Q)rm -rf autom4te.cache Logs
96
97 dist: include/builddefs include/config.h default
98 ifeq ($(HAVE_BUILDDEFS), no)
99         $(Q)$(MAKE) $(MAKEOPTS) -C . $@
100 else
101         $(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
102 endif
103
104 $(SRCTAR) : default
105         $(Q)git archive --prefix=$(PKG_NAME)-$(PKG_VERSION)/ --format=tar \
106           v$(PKG_VERSION) > $(PKG_NAME)-$(PKG_VERSION).tar
107         $(Q)$(TAR) --transform "s,^,$(PKG_NAME)-$(PKG_VERSION)/," \
108           -rf $(PKG_NAME)-$(PKG_VERSION).tar $(CONFIGURE)
109         $(Q)$(ZIP) $(PKG_NAME)-$(PKG_VERSION).tar
110         echo Wrote: $@