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