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