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