]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - Makefile
Merge branch 'progs-cleanup' into for-next
[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
30 CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
31 LSRCFILES = configure.ac release.sh README VERSION $(CONFIGURE)
32 SRCTARINC = m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 \
33 m4/ltversion.m4 po/xfsprogs.pot .gitcensus $(CONFIGURE)
34 LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
35 conftest* built .census install.* install-dev.* *.gz \
36 autom4te.cache/* libtool include/builddefs include/platform_defs.h
37
38 ifeq ($(HAVE_BUILDDEFS), yes)
39 LDIRDIRT = $(SRCDIR)
40 LDIRT += $(SRCTAR)
41 endif
42
43 # header install rules to populate include/xfs correctly
44 HDR_SUBDIRS = include libxfs
45
46 DLIB_SUBDIRS = libxlog libxcmd libhandle libdisk
47 LIB_SUBDIRS = libxfs $(DLIB_SUBDIRS)
48 TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \
49 mdrestore repair rtcp m4 man doc po debian
50
51 # include is listed last so it is processed last in clean rules.
52 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) include
53
54 default: include/builddefs include/platform_defs.h
55 ifeq ($(HAVE_BUILDDEFS), no)
56 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
57 else
58 $(Q)$(MAKE) $(MAKEOPTS) headers
59 $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
60 endif
61
62 # tool/lib dependencies
63 # note: include/xfs is set up by libxfs, too, so everything is dependent on it.
64 $(LIB_SUBDIRS) $(TOOL_SUBDIRS): include
65 $(DLIB_SUBDIRS) $(TOOL_SUBDIRS): libxfs
66 db logprint: libxlog
67 fsr: libhandle
68 growfs: libxcmd
69 io: libxcmd libhandle
70 quota: libxcmd
71 repair: libxlog
72
73
74 ifneq ($(ENABLE_BLKID), yes)
75 mkfs: libdisk
76 endif
77
78 ifeq ($(HAVE_BUILDDEFS), yes)
79 include $(BUILDRULES)
80 else
81 clean: # if configure hasn't run, nothing to clean
82 endif
83
84 # Recent versions of libtool require the -i option for copying auxiliary
85 # files (config.sub, config.guess, install-sh, ltmain.sh), while older
86 # versions will copy those files anyway, and don't understand -i.
87 LIBTOOLIZE_INSTALL = `libtoolize -n -i >/dev/null 2>/dev/null && echo -i`
88
89 configure:
90 libtoolize -c $(LIBTOOLIZE_INSTALL) -f
91 cp include/install-sh .
92 aclocal -I m4
93 autoconf
94
95 include/builddefs: configure
96 ./configure $$LOCAL_CONFIGURE_OPTIONS
97
98 include/platform_defs.h: include/builddefs
99 ## Recover from the removal of $@
100 @if test -f $@; then :; else \
101 rm -f include/builddefs; \
102 $(MAKE) $(MAKEOPTS) $(AM_MAKEFLAGS) include/builddefs; \
103 fi
104
105 install: $(addsuffix -install,$(SUBDIRS))
106 $(INSTALL) -m 755 -d $(PKG_DOC_DIR)
107 $(INSTALL) -m 644 README $(PKG_DOC_DIR)
108
109 install-dev: $(addsuffix -install-dev,$(SUBDIRS))
110
111 install-qa: install $(addsuffix -install-qa,$(SUBDIRS))
112
113 %-install:
114 @echo "Installing $@"
115 $(Q)$(MAKE) $(MAKEOPTS) -C $* install
116
117 %-install-dev:
118 @echo "Installing $@"
119 $(Q)$(MAKE) $(MAKEOPTS) -C $* install-dev
120
121 %-install-qa:
122 @echo "Installing $@"
123 $(Q)$(MAKE) $(MAKEOPTS) -C $* install-qa
124
125 distclean: clean
126 $(Q)rm -f $(LDIRT)
127
128 realclean: distclean
129 $(Q)rm -f $(CONFIGURE) .gitcensus
130
131 #
132 # All this gunk is to allow for a make dist on an unconfigured tree
133 #
134 dist: include/builddefs include/platform_defs.h default
135 ifeq ($(HAVE_BUILDDEFS), no)
136 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
137 else
138 $(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
139 endif
140
141 deb: include/builddefs include/platform_defs.h
142 ifeq ($(HAVE_BUILDDEFS), no)
143 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
144 else
145 # need to build translations before the source tarball
146 $(Q)$(MAKE) $(MAKEOPTS) -C po
147 $(Q)$(MAKE) $(MAKEOPTS) $(SRCDIR)
148 $(Q)cd $(SRCDIR) && dpkg-buildpackage
149 endif
150
151 $(SRCDIR) : $(_FORCE) $(SRCTAR)
152 rm -fr $@
153 $(Q)$(TAR) -zxvf $(SRCTAR)
154
155 $(SRCTAR) : default $(SRCTARINC) .gitcensus
156 $(Q)$(TAR) --transform "s,^,$(SRCDIR)/," -zcf $(SRCDIR).tar.gz \
157 `cat .gitcensus` $(SRCTARINC)
158 echo Wrote: $@
159
160 .gitcensus: $(_FORCE)
161 $(Q)if test -d .git; then \
162 git ls-files > .gitcensus && echo "new .gitcensus"; \
163 fi