set correct doc dir
[platform/upstream/attr.git] / Makefile
1 #
2 # Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
3 # Copyright (C) 2009  Andreas Gruenbacher <agruen@suse.de>
4 #
5 # This program is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #
18
19 TOPDIR = .
20 HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
21
22 ifeq ($(HAVE_BUILDDEFS), yes)
23 include $(TOPDIR)/include/builddefs
24 endif
25
26 CONFIGURE = \
27         aclocal.m4 \
28         configure config.guess config.sub \
29         ltmain.sh m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 \
30         m4/ltversion.m4 m4/lt~obsolete.m4
31 LSRCFILES = \
32         configure.in Makepkgs install-sh exports README VERSION \
33         $(CONFIGURE)
34
35 LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
36         Logs/* built .census install.* install-dev.* install-lib.* *.gz
37
38 LIB_SUBDIRS = include libmisc libattr
39 TOOL_SUBDIRS = attr getfattr setfattr examples test m4 man doc po debian package
40
41 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
42
43 default: include/builddefs include/config.h
44 ifeq ($(HAVE_BUILDDEFS), no)
45         $(MAKE) -C . $@
46 else
47         $(MAKE) $(SUBDIRS)
48 endif
49
50 # tool/lib dependencies
51 libattr: include
52 getfattr setfattr: libmisc libattr
53 attr: libattr
54
55 ifeq ($(HAVE_BUILDDEFS), yes)
56 include $(BUILDRULES)
57 else
58 clean:  # if configure hasn't run, nothing to clean
59 endif
60
61 # Recent versions of libtool require the -i option for copying auxiliary
62 # files (config.sub, config.guess, install-sh, ltmain.sh), while older
63 # versions will copy those files anyway, and don't understand -i.
64 LIBTOOLIZE_INSTALL = `libtoolize -n -i >/dev/null 2>/dev/null && echo -i`
65
66 configure include/builddefs:
67         libtoolize -c $(LIBTOOLIZE_INSTALL) -f
68         cp include/install-sh .
69         aclocal -I m4
70         autoconf
71         ./configure \
72                 --prefix=/ \
73                 --exec-prefix=/ \
74                 --sbindir=/bin \
75                 --bindir=/usr/bin \
76                 --libdir=/lib \
77                 --libexecdir=/usr/lib \
78                 --enable-lib64=yes \
79                 --includedir=/usr/include \
80                 --mandir=/usr/share/man \
81                 --datadir=/usr/share \
82                 $$LOCAL_CONFIGURE_OPTIONS
83         touch .census
84
85 include/config.h: include/builddefs
86 ## Recover from the removal of $@
87         @if test -f $@; then :; else \
88                 rm -f include/builddefs; \
89                 $(MAKE) $(AM_MAKEFLAGS) include/builddefs; \
90         fi
91
92 install: default $(addsuffix -install,$(SUBDIRS))
93         $(INSTALL) -m 755 -d $(PKG_DOC_DIR)
94         $(INSTALL) -m 644 README $(PKG_DOC_DIR)
95
96 install-dev: default $(addsuffix -install-dev,$(SUBDIRS))
97
98 install-lib: install $(addsuffix -install-lib,$(SUBDIRS))
99
100 %-install:
101         $(MAKE) -C $* install
102
103 %-install-dev:
104         $(MAKE) -C $* install-dev
105
106 %-install-lib:
107         $(MAKE) -C $* install-lib
108
109 realclean distclean: clean
110         rm -f $(LDIRT) $(CONFIGURE)
111         rm -f include/builddefs include/config.h install-sh libtool
112         rm -rf autom4te.cache Logs
113
114 .PHONY: tests root-tests ext-tests
115 tests root-tests ext-tests: default
116         $(MAKE) -C test/ $@
117
118 # HACK: Convert the man pages into html
119 html:
120         @for man in $$(find man -name '*.[1-9]'); do \
121                 echo $${man%.*}.html ; \
122                 groff -man -Thtml -P-h -P-l $$man > $${man%.*}.html; \
123         done