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