]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - Makefile
simplify and unify source package generation
[thirdparty/xfsprogs-dev.git] / Makefile
1 #
2 # Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
3 #
4
5 TOPDIR = .
6 HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
7
8 ifeq ($(HAVE_BUILDDEFS), yes)
9 include $(TOPDIR)/include/builddefs
10 endif
11
12 SRCDIR = $(PKG_NAME)-$(PKG_VERSION)
13 SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
14
15 CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
16 LSRCFILES = configure.in release.sh README VERSION $(CONFIGURE)
17
18 LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
19 built .census install.* install-dev.* *.gz autom4te.cache/* libtool \
20 include/builddefs include/platform_defs.h
21
22 ifeq ($(HAVE_BUILDDEFS), yes)
23 LDIRDIRT = $(SRCDIR)
24 LDIRT += $(SRCTAR)
25 endif
26
27 LIB_SUBDIRS = libxfs libxlog libxcmd libhandle $(LDISK)
28 TOOL_SUBDIRS = copy db estimate fsck fsr growfs io logprint mkfs quota \
29 mdrestore repair rtcp m4 man doc po debian
30
31 ifneq ($(ENABLE_BLKID), yes)
32 LIB_SUBDIRS += libdisk
33 endif
34
35 SUBDIRS = include $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
36
37 default: include/builddefs include/platform_defs.h
38 ifeq ($(HAVE_BUILDDEFS), no)
39 $(MAKE) -C . $@
40 else
41 $(MAKE) $(SUBDIRS)
42 endif
43
44 # tool/lib dependencies
45 $(LIB_SUBDIRS) $(TOOL_SUBDIRS): include
46 copy mdrestore: libxfs
47 db logprint: libxfs libxlog
48 fsr: libhandle
49 growfs: libxfs libxcmd
50 io: libxcmd libhandle
51 mkfs: libxfs
52 quota: libxcmd
53 repair: libxfs libxlog
54
55 ifneq ($(ENABLE_BLKID), yes)
56 mkfs: libdisk
57 endif
58
59 ifeq ($(HAVE_BUILDDEFS), yes)
60 include $(BUILDRULES)
61 else
62 clean: # if configure hasn't run, nothing to clean
63 endif
64
65 # Recent versions of libtool require the -i option for copying auxiliary
66 # files (config.sub, config.guess, install-sh, ltmain.sh), while older
67 # versions will copy those files anyway, and don't understand -i.
68 LIBTOOLIZE_INSTALL = `libtoolize -n -i >/dev/null 2>/dev/null && echo -i`
69
70 configure:
71 libtoolize -c $(LIBTOOLIZE_INSTALL) -f
72 cp include/install-sh .
73 aclocal -I m4
74 autoconf
75
76 include/builddefs: configure
77 ./configure $$LOCAL_CONFIGURE_OPTIONS
78
79 include/platform_defs.h: include/builddefs
80 ## Recover from the removal of $@
81 @if test -f $@; then :; else \
82 rm -f include/builddefs; \
83 $(MAKE) $(AM_MAKEFLAGS) include/builddefs; \
84 fi
85
86 install: default $(addsuffix -install,$(SUBDIRS))
87 $(INSTALL) -m 755 -d $(PKG_DOC_DIR)
88 $(INSTALL) -m 644 README $(PKG_DOC_DIR)
89
90 install-dev: default $(addsuffix -install-dev,$(SUBDIRS))
91
92 install-qa: install $(addsuffix -install-qa,$(SUBDIRS))
93
94 %-install:
95 $(MAKE) -C $* install
96
97 %-install-dev:
98 $(MAKE) -C $* install-dev
99
100 %-install-qa:
101 $(MAKE) -C $* install-qa
102
103 distclean: clean
104 rm -f $(LDIRT)
105
106 realclean: distclean
107 rm -f $(CONFIGURE)
108
109 #
110 # All this gunk is to allow for a make dist on an unconfigured tree
111 #
112 dist: include/builddefs include/platform_defs.h default
113 ifeq ($(HAVE_BUILDDEFS), no)
114 $(MAKE) -C . $@
115 else
116 $(MAKE) $(SRCTAR)
117 endif
118
119 deb: include/builddefs include/platform_defs.h
120 ifeq ($(HAVE_BUILDDEFS), no)
121 $(MAKE) -C . $@
122 else
123 $(MAKE) $(SRCDIR)
124 $(MAKE) -C po
125 $(MAKE) source-link
126 cd $(SRCDIR) && dpkg-buildpackage
127 endif
128
129 $(SRCDIR) : $(_FORCE)
130 rm -fr $@
131 mkdir -p $@
132
133 $(SRCTAR) : default $(SRCDIR)
134 $(MAKE) source-link
135 unset TAPE; $(TAR) -cf - $(SRCDIR) | $(ZIP) --best > $@ && \
136 echo Wrote: $@