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 CONFIGURE = configure include/builddefs include/config.h
45 LSRCFILES = configure configure.ac aclocal.m4 README VERSION
46 LDIRT = config.log .ltdep .dep config.status config.cache confdefs.h \
47 conftest* check.log check.time
49 ifeq ($(HAVE_BUILDDEFS), yes)
53 LIB_SUBDIRS = include lib
54 TOOL_SUBDIRS = ltp src m4 common
55 ifeq ($(HAVE_DMAPI), true)
59 export TESTS_DIR = tests
60 SUBDIRS = $(LIB_SUBDIRS) $(TOOL_SUBDIRS) $(TESTS_DIR)
62 default: include/builddefs $(DMAPI_MAKEFILE)
63 ifeq ($(HAVE_BUILDDEFS), no)
64 $(Q)$(MAKE) $(MAKEOPTS) $@
66 $(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
69 # tool/lib dependencies
70 $(TOOL_SUBDIRS): $(LIB_SUBDIRS)
72 ifeq ($(HAVE_BUILDDEFS), yes)
75 clean: # if configure hasn't run, nothing to clean
78 configure: configure.ac
82 include/builddefs include/config.h: configure
87 aclocal --acdir=`pwd`/m4 --output=$@
89 depend: include/builddefs $(addsuffix -depend,$(SUBDIRS))
91 install: default $(addsuffix -install,$(SUBDIRS))
92 $(INSTALL) -m 755 -d $(PKG_LIB_DIR)
93 $(INSTALL) -m 755 check $(PKG_LIB_DIR)
94 $(INSTALL) -m 644 randomize.awk $(PKG_LIB_DIR)
97 install-dev install-lib:
100 $(MAKE) $(MAKEOPTS) -C $* install
102 realclean distclean: clean
103 $(Q)rm -f $(LDIRT) $(CONFIGURE)
104 $(Q)rm -rf autom4te.cache Logs
106 dist: include/builddefs include/config.h default
107 ifeq ($(HAVE_BUILDDEFS), no)
108 $(Q)$(MAKE) $(MAKEOPTS) -C . $@
110 $(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
114 $(Q)git archive --prefix=$(PKG_NAME)-$(PKG_VERSION)/ --format=tar \
115 v$(PKG_VERSION) > $(PKG_NAME)-$(PKG_VERSION).tar
116 $(Q)$(TAR) --transform "s,^,$(PKG_NAME)-$(PKG_VERSION)/," \
117 -rf $(PKG_NAME)-$(PKG_VERSION).tar $(CONFIGURE)
118 $(Q)$(ZIP) $(PKG_NAME)-$(PKG_VERSION).tar