]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame_incremental - Makefile
xfs_metadump: Zap unused space in inode btrees
[thirdparty/xfsprogs-dev.git] / Makefile
... / ...
CommitLineData
1# SPDX-License-Identifier: GPL-2.0
2#
3# Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
4#
5
6ifeq ("$(origin V)", "command line")
7 BUILD_VERBOSE = $(V)
8endif
9ifndef BUILD_VERBOSE
10 BUILD_VERBOSE = 0
11endif
12
13ifeq ($(BUILD_VERBOSE),1)
14 Q =
15else
16 Q = @
17endif
18
19CHECK=sparse
20CHECK_OPTS=-Wsparse-all -Wbitwise -Wno-transparent-union -Wno-return-void -Wno-undef \
21 -Wno-non-pointer-null -D__CHECK_ENDIAN__ -D__linux__
22
23ifeq ("$(origin C)", "command line")
24 CHECK_CMD=$(CHECK) $(CHECK_OPTS)
25 CHECKSRC=$(C)
26else
27 CHECK_CMD=@true
28 CHECKSRC=0
29endif
30
31export CHECK_CMD CHECKSRC
32
33MAKEOPTS = --no-print-directory Q=$(Q)
34
35TOPDIR = .
36HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
37
38ifeq ($(HAVE_BUILDDEFS), yes)
39include $(TOPDIR)/include/builddefs
40endif
41
42SRCDIR = $(PKG_NAME)-$(PKG_VERSION)
43SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
44SRCTARXZ = $(PKG_NAME)-$(PKG_VERSION).tar.xz
45
46CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
47LSRCFILES = configure.ac release.sh README VERSION $(CONFIGURE)
48SRCTARINC = m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 \
49 m4/ltversion.m4 po/xfsprogs.pot .gitcensus $(CONFIGURE)
50LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
51 conftest* built .census install.* install-dev.* *.gz *.xz \
52 autom4te.cache/* libtool include/builddefs include/platform_defs.h
53
54ifeq ($(HAVE_BUILDDEFS), yes)
55LDIRDIRT = $(SRCDIR)
56LDIRT += $(SRCTAR) $(SRCTARXZ)
57endif
58
59# header install rules to populate include/xfs correctly
60HDR_SUBDIRS = include libxfs
61
62LIBFROG_SUBDIR = libfrog
63DLIB_SUBDIRS = libxlog libxcmd libhandle
64LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS)
65TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \
66 mdrestore repair rtcp m4 man doc debian spaceman
67
68ifeq ("$(ENABLE_SCRUB)","yes")
69TOOL_SUBDIRS += scrub
70endif
71
72ifneq ("$(XGETTEXT)","")
73TOOL_SUBDIRS += po
74endif
75
76# If we are on OS X, use glibtoolize from MacPorts, as OS X doesn't have
77# libtoolize binary itself.
78LIBTOOLIZE_TEST=$(shell libtoolize --version >/dev/null 2>&1 && echo found)
79LIBTOOLIZE_BIN=libtoolize
80ifneq ("$(LIBTOOLIZE_TEST)","found")
81LIBTOOLIZE_BIN=glibtoolize
82endif
83
84# include is listed last so it is processed last in clean rules.
85SUBDIRS = $(LIBFROG_SUBDIR) $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include
86
87default: include/builddefs include/platform_defs.h
88ifeq ($(HAVE_BUILDDEFS), no)
89 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
90else
91 $(Q)$(MAKE) $(MAKEOPTS) headers
92 $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
93endif
94
95# tool/lib dependencies
96# note: include/xfs is set up by libxfs, too, so everything is dependent on it.
97$(LIBFROG_SUBDIR): include
98$(LIB_SUBDIRS) $(TOOL_SUBDIRS): include libfrog
99$(DLIB_SUBDIRS) $(TOOL_SUBDIRS): libxfs
100db logprint: libxlog
101fsr: libhandle
102growfs: libxcmd
103io: libxcmd libhandle
104quota: libxcmd
105repair: libxlog libxcmd
106copy: libxlog
107mkfs: libxcmd
108spaceman: libxcmd
109scrub: libhandle libxcmd
110
111ifeq ($(HAVE_BUILDDEFS), yes)
112include $(BUILDRULES)
113else
114clean: # if configure hasn't run, nothing to clean
115endif
116
117
118# Recent versions of libtool require the -i option for copying auxiliary
119# files (config.sub, config.guess, install-sh, ltmain.sh), while older
120# versions will copy those files anyway, and don't understand -i.
121LIBTOOLIZE_INSTALL = `$(LIBTOOLIZE_BIN) -n -i >/dev/null 2>/dev/null && echo -i`
122
123configure: configure.ac
124 $(LIBTOOLIZE_BIN) -c $(LIBTOOLIZE_INSTALL) -f
125 cp include/install-sh .
126 aclocal -I m4
127 autoconf
128
129include/builddefs: configure
130 ./configure $$LOCAL_CONFIGURE_OPTIONS
131
132include/platform_defs.h: include/builddefs
133## Recover from the removal of $@
134 @if test -f $@; then :; else \
135 rm -f include/builddefs; \
136 $(MAKE) $(MAKEOPTS) $(AM_MAKEFLAGS) include/builddefs; \
137 fi
138
139install: $(addsuffix -install,$(SUBDIRS))
140 $(INSTALL) -m 755 -d $(PKG_DOC_DIR)
141 $(INSTALL) -m 644 README $(PKG_DOC_DIR)
142
143install-dev: $(addsuffix -install-dev,$(SUBDIRS))
144
145%-install:
146 @echo "Installing $@"
147 $(Q)$(MAKE) $(MAKEOPTS) -C $* install
148
149%-install-dev:
150 @echo "Installing $@"
151 $(Q)$(MAKE) $(MAKEOPTS) -C $* install-dev
152
153distclean: clean
154 $(Q)rm -f $(LDIRT)
155
156realclean: distclean
157 $(Q)rm -f $(CONFIGURE) .gitcensus
158
159#
160# All this gunk is to allow for a make dist on an unconfigured tree
161#
162dist: include/builddefs include/platform_defs.h default
163ifeq ($(HAVE_BUILDDEFS), no)
164 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
165else
166 $(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
167endif
168
169deb: include/builddefs include/platform_defs.h
170ifeq ($(HAVE_BUILDDEFS), no)
171 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
172else
173 # need to build translations before the source tarball
174 $(Q)$(MAKE) $(MAKEOPTS) -C po
175 $(Q)$(MAKE) $(MAKEOPTS) $(SRCDIR)
176 $(Q)rm -f $(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
177 $(Q)$(LN_S) $(SRCTAR) $(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
178 $(Q)cd $(SRCDIR) && dpkg-buildpackage $$LOCAL_DPKG_OPTIONS # -sa -S
179endif
180
181$(SRCDIR) : $(_FORCE) $(SRCTAR)
182 rm -fr $@
183 $(Q)$(TAR) -zxvf $(SRCTAR)
184
185$(SRCTAR) : default $(SRCTARINC) .gitcensus
186 $(Q)$(TAR) --transform "s,^,$(SRCDIR)/," -zcf $(SRCDIR).tar.gz \
187 `cat .gitcensus` $(SRCTARINC)
188 echo Wrote: $@
189
190$(SRCTARXZ) : default $(SRCTARINC) .gitcensus
191 $(Q)$(TAR) --transform "s,^,$(SRCDIR)/," -Jcf $(SRCDIR).tar.xz \
192 `cat .gitcensus` $(SRCTARINC)
193 echo Wrote: $@
194
195.gitcensus: $(_FORCE)
196 $(Q)if test -d .git; then \
197 git ls-files > .gitcensus && echo "new .gitcensus"; \
198 fi