]>
Commit | Line | Data |
---|---|---|
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 |
6 | ifeq ("$(origin V)", "command line") |
7 | BUILD_VERBOSE = $(V) | |
8 | endif | |
9 | ifndef BUILD_VERBOSE | |
10 | BUILD_VERBOSE = 0 | |
11 | endif | |
12 | ||
13 | ifeq ($(BUILD_VERBOSE),1) | |
14 | Q = | |
15 | else | |
16 | Q = @ | |
17 | endif | |
18 | ||
d4739a50 ES |
19 | CHECK=sparse |
20 | CHECK_OPTS=-Wsparse-all -Wbitwise -Wno-transparent-union -Wno-return-void -Wno-undef \ | |
21 | -Wno-non-pointer-null -D__CHECK_ENDIAN__ -D__linux__ | |
22 | ||
23 | ifeq ("$(origin C)", "command line") | |
e51fde01 ES |
24 | CHECK_CMD=$(CHECK) $(CHECK_OPTS) |
25 | CHECKSRC=$(C) | |
26 | else | |
27 | CHECK_CMD=@true | |
28 | CHECKSRC=0 | |
d4739a50 ES |
29 | endif |
30 | ||
e51fde01 | 31 | export CHECK_CMD CHECKSRC |
d4739a50 | 32 | |
35714853 DC |
33 | MAKEOPTS = --no-print-directory Q=$(Q) |
34 | ||
fc49813f NS |
35 | TOPDIR = . |
36 | HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no) | |
37 | ||
38 | ifeq ($(HAVE_BUILDDEFS), yes) | |
39 | include $(TOPDIR)/include/builddefs | |
40 | endif | |
41 | ||
10a41599 CH |
42 | SRCDIR = $(PKG_NAME)-$(PKG_VERSION) |
43 | SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz | |
1f31bd25 | 44 | SRCTARXZ = $(PKG_NAME)-$(PKG_VERSION).tar.xz |
10a41599 | 45 | |
42e5b5df | 46 | CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh |
81fba137 | 47 | LSRCFILES = configure.ac release.sh README VERSION $(CONFIGURE) |
56c84e02 | 48 | SRCTARINC = m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 \ |
48212a30 | 49 | m4/ltversion.m4 po/xfsprogs.pot .gitcensus $(CONFIGURE) |
932b0ba9 | 50 | LDIRT = 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 | |
54 | ifeq ($(HAVE_BUILDDEFS), yes) | |
55 | LDIRDIRT = $(SRCDIR) | |
1f31bd25 | 56 | LDIRT += $(SRCTAR) $(SRCTARXZ) |
10a41599 | 57 | endif |
f937adac | 58 | |
337d9a24 DC |
59 | # header install rules to populate include/xfs correctly |
60 | HDR_SUBDIRS = include libxfs | |
636b4d91 | 61 | |
b28b84ca DW |
62 | LIBFROG_SUBDIR = libfrog |
63 | DLIB_SUBDIRS = libxlog libxcmd libhandle | |
636b4d91 | 64 | LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS) |
231a533c | 65 | TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \ |
9fae859a ES |
66 | mdrestore repair rtcp m4 man doc debian spaceman |
67 | ||
68 | ifeq ("$(ENABLE_SCRUB)","yes") | |
69 | TOOL_SUBDIRS += scrub | |
70 | endif | |
dd30c0ae JT |
71 | |
72 | ifneq ("$(XGETTEXT)","") | |
73 | TOOL_SUBDIRS += po | |
74 | endif | |
fc49813f | 75 | |
5d87ed9d JT |
76 | # If we are on OS X, use glibtoolize from MacPorts, as OS X doesn't have |
77 | # libtoolize binary itself. | |
78 | LIBTOOLIZE_TEST=$(shell libtoolize --version >/dev/null 2>&1 && echo found) | |
79 | LIBTOOLIZE_BIN=libtoolize | |
80 | ifneq ("$(LIBTOOLIZE_TEST)","found") | |
81 | LIBTOOLIZE_BIN=glibtoolize | |
82 | endif | |
83 | ||
cebd3912 | 84 | # include is listed last so it is processed last in clean rules. |
b28b84ca | 85 | SUBDIRS = $(LIBFROG_SUBDIR) $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include |
2a519b73 | 86 | |
1eb10ccb | 87 | default: include/builddefs include/platform_defs.h |
fc49813f | 88 | ifeq ($(HAVE_BUILDDEFS), no) |
35714853 | 89 | $(Q)$(MAKE) $(MAKEOPTS) -C . $@ |
fc49813f | 90 | else |
337d9a24 | 91 | $(Q)$(MAKE) $(MAKEOPTS) headers |
35714853 | 92 | $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS) |
fc49813f NS |
93 | endif |
94 | ||
2a519b73 | 95 | # tool/lib dependencies |
636b4d91 | 96 | # note: include/xfs is set up by libxfs, too, so everything is dependent on it. |
b28b84ca DW |
97 | $(LIBFROG_SUBDIR): include |
98 | $(LIB_SUBDIRS) $(TOOL_SUBDIRS): include libfrog | |
636b4d91 DC |
99 | $(DLIB_SUBDIRS) $(TOOL_SUBDIRS): libxfs |
100 | db logprint: libxlog | |
bf3256b2 | 101 | fsr: libhandle |
636b4d91 | 102 | growfs: libxcmd |
2a519b73 | 103 | io: libxcmd libhandle |
2a519b73 | 104 | quota: libxcmd |
1b1b5359 | 105 | repair: libxlog libxcmd |
3616eb86 | 106 | copy: libxlog |
82c3a179 | 107 | mkfs: libxcmd |
48ec2905 | 108 | spaceman: libxcmd |
95b1e505 | 109 | scrub: libhandle libxcmd |
2a519b73 | 110 | |
fc49813f NS |
111 | ifeq ($(HAVE_BUILDDEFS), yes) |
112 | include $(BUILDRULES) | |
113 | else | |
114 | clean: # if configure hasn't run, nothing to clean | |
115 | endif | |
116 | ||
5d87ed9d | 117 | |
07c561fe AG |
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. | |
5d87ed9d | 121 | LIBTOOLIZE_INSTALL = `$(LIBTOOLIZE_BIN) -n -i >/dev/null 2>/dev/null && echo -i` |
07c561fe | 122 | |
5893de54 | 123 | configure: configure.ac |
5d87ed9d | 124 | $(LIBTOOLIZE_BIN) -c $(LIBTOOLIZE_INSTALL) -f |
07c561fe AG |
125 | cp include/install-sh . |
126 | aclocal -I m4 | |
fc49813f | 127 | autoconf |
1eb10ccb CH |
128 | |
129 | include/builddefs: configure | |
595e27db | 130 | ./configure $$LOCAL_CONFIGURE_OPTIONS |
fc49813f | 131 | |
2a519b73 BN |
132 | include/platform_defs.h: include/builddefs |
133 | ## Recover from the removal of $@ | |
134 | @if test -f $@; then :; else \ | |
135 | rm -f include/builddefs; \ | |
35714853 | 136 | $(MAKE) $(MAKEOPTS) $(AM_MAKEFLAGS) include/builddefs; \ |
2a519b73 BN |
137 | fi |
138 | ||
91128e4c | 139 | install: $(addsuffix -install,$(SUBDIRS)) |
fc49813f NS |
140 | $(INSTALL) -m 755 -d $(PKG_DOC_DIR) |
141 | $(INSTALL) -m 644 README $(PKG_DOC_DIR) | |
142 | ||
91128e4c | 143 | install-dev: $(addsuffix -install-dev,$(SUBDIRS)) |
2a519b73 | 144 | |
2a519b73 | 145 | %-install: |
91128e4c DC |
146 | @echo "Installing $@" |
147 | $(Q)$(MAKE) $(MAKEOPTS) -C $* install | |
2a519b73 BN |
148 | |
149 | %-install-dev: | |
91128e4c DC |
150 | @echo "Installing $@" |
151 | $(Q)$(MAKE) $(MAKEOPTS) -C $* install-dev | |
fc49813f | 152 | |
1eb10ccb | 153 | distclean: clean |
35714853 | 154 | $(Q)rm -f $(LDIRT) |
1eb10ccb CH |
155 | |
156 | realclean: distclean | |
48212a30 | 157 | $(Q)rm -f $(CONFIGURE) .gitcensus |
10a41599 CH |
158 | |
159 | # | |
160 | # All this gunk is to allow for a make dist on an unconfigured tree | |
161 | # | |
162 | dist: include/builddefs include/platform_defs.h default | |
163 | ifeq ($(HAVE_BUILDDEFS), no) | |
35714853 | 164 | $(Q)$(MAKE) $(MAKEOPTS) -C . $@ |
10a41599 | 165 | else |
35714853 | 166 | $(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR) |
10a41599 CH |
167 | endif |
168 | ||
169 | deb: include/builddefs include/platform_defs.h | |
170 | ifeq ($(HAVE_BUILDDEFS), no) | |
35714853 | 171 | $(Q)$(MAKE) $(MAKEOPTS) -C . $@ |
10a41599 | 172 | else |
8a70f64c DC |
173 | # need to build translations before the source tarball |
174 | $(Q)$(MAKE) $(MAKEOPTS) -C po | |
35714853 | 175 | $(Q)$(MAKE) $(MAKEOPTS) $(SRCDIR) |
ec1cf08d NS |
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 | |
10a41599 CH |
179 | endif |
180 | ||
48212a30 | 181 | $(SRCDIR) : $(_FORCE) $(SRCTAR) |
10a41599 | 182 | rm -fr $@ |
48212a30 | 183 | $(Q)$(TAR) -zxvf $(SRCTAR) |
10a41599 | 184 | |
48212a30 BM |
185 | $(SRCTAR) : default $(SRCTARINC) .gitcensus |
186 | $(Q)$(TAR) --transform "s,^,$(SRCDIR)/," -zcf $(SRCDIR).tar.gz \ | |
187 | `cat .gitcensus` $(SRCTARINC) | |
10a41599 | 188 | echo Wrote: $@ |
48212a30 | 189 | |
1f31bd25 ES |
190 | $(SRCTARXZ) : default $(SRCTARINC) .gitcensus |
191 | $(Q)$(TAR) --transform "s,^,$(SRCDIR)/," -Jcf $(SRCDIR).tar.xz \ | |
192 | `cat .gitcensus` $(SRCTARINC) | |
193 | echo Wrote: $@ | |
194 | ||
48212a30 BM |
195 | .gitcensus: $(_FORCE) |
196 | $(Q)if test -d .git; then \ | |
197 | git ls-files > .gitcensus && echo "new .gitcensus"; \ | |
198 | fi |