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