2 # Copyright (C) 2000-2008, 2011 SGI All Rights Reserved.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 ifeq ("$(origin V)", "command line")
27 ifeq ($(BUILD_VERBOSE),1)
33 MAKEOPTS = --no-print-directory Q=$(Q)
36 HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
38 ifeq ($(HAVE_BUILDDEFS), yes)
39 include $(TOPDIR)/include/builddefs
42 SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
44 TESTS = $(shell sed -n -e '/^[0-9][0-9][0-9]*/s/ .*//p' group)
45 CONFIGURE = configure include/builddefs include/config.h
46 LSRCFILES = configure configure.ac aclocal.m4 README VERSION
47 LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
48 conftest* check.log check.time
50 ifeq ($(HAVE_BUILDDEFS), yes)
54 LIB_SUBDIRS = include lib
55 TOOL_SUBDIRS = ltp src m4 common
56 ifeq ($(HAVE_DMAPI), true)
60 export TESTS_DIR = tests
61 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR)
63 default: include/builddefs $(DMAPI_MAKEFILE) $(TESTS)
64 ifeq ($(HAVE_BUILDDEFS), no)
65 $(Q)$(MAKE) $(MAKEOPTS) $@
67 $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
70 # tool/lib dependencies
71 $(TOOL_SUBDIRS): $(LIB_SUBDIRS)
73 ifeq ($(HAVE_BUILDDEFS), yes)
76 clean: # if configure hasn't run, nothing to clean
79 configure: configure.ac
83 include/builddefs include/config.h: configure
88 aclocal --acdir=`pwd`/m4 --output=$@
90 depend: include/builddefs $(addsuffix -depend,$(SUBDIRS))
92 install: default $(addsuffix -install,$(SUBDIRS))
93 $(INSTALL) -m 755 -d $(PKG_LIB_DIR)
94 $(INSTALL) -m 755 check $(PKG_LIB_DIR)
95 $(INSTALL) -m 644 randomize.awk $(PKG_LIB_DIR)
98 install-dev install-lib:
101 $(MAKE) $(MAKEOPTS) -C $* install
103 realclean distclean: clean
104 $(Q)rm -f $(LDIRT) $(CONFIGURE)
105 $(Q)rm -rf autom4te.cache Logs
107 dist: include/builddefs include/config.h default
108 ifeq ($(HAVE_BUILDDEFS), no)
109 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
111 $(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
115 $(Q)git archive --prefix=$(PKG_NAME)-$(PKG_VERSION)/ --format=tar \
116 v$(PKG_VERSION) > $(PKG_NAME)-$(PKG_VERSION).tar
117 $(Q)$(TAR) --transform "s,^,$(PKG_NAME)-$(PKG_VERSION)/," \
118 -rf $(PKG_NAME)-$(PKG_VERSION).tar $(CONFIGURE)
119 $(Q)$(ZIP) $(PKG_NAME)-$(PKG_VERSION).tar