Add Makepkgs support to xfstests (tar & rpm only so far)
[xfstests-dev.git] / build / Makefile
1 #
2 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
3 #
4
5 TOPDIR = ..
6 include $(TOPDIR)/include/builddefs
7
8 MANIFEST=src-manifest
9 SRCTAR=$(PKG_NAME)-$(PKG_VERSION).src.tar.gz
10
11 LDIRT = *-manifest *.gz $(TOPDIR)/$(PKG_NAME)-*
12
13 # for clean and clobber
14 SUBDIRS = tar rpm
15
16 # nothing to build here (it's all packaging)
17 default install install-dev install-lib:
18
19 include $(BUILDRULES)
20
21 # Symlink in the TOPDIR is used to pack files relative to
22 # product-version directory.
23 $(MANIFEST) : $(_FORCE)
24         @if [ ! -L $(TOPDIR)/$(PKG_NAME)-$(PKG_VERSION) ] ; then \
25             $(LN_S) . $(TOPDIR)/$(PKG_NAME)-$(PKG_VERSION) ; \
26         fi
27         @CDIR=`pwd`; cd $(TOPDIR); \
28         $(MAKE) --no-print-directory source | \
29             sed -e 's/^\./$(PKG_NAME)-$(PKG_VERSION)/' > $$CDIR/$@ ;\
30         if [ $$? -ne 0 ] ; then  \
31             exit 1; \
32         else \
33             unset TAPE; \
34             $(TAR) -T $$CDIR/$@ -cf - | $(ZIP) --best > $$CDIR/$(SRCTAR); \
35             echo Wrote: $$CDIR/$(SRCTAR); \
36         fi
37
38 dist : default $(MANIFEST)
39         @DIST_MANIFEST=`pwd`/bin-manifest; DIST_ROOT=/tmp/$$$$; \
40         export DIST_MANIFEST DIST_ROOT; \
41         rm -f $$DIST_MANIFEST; \
42         echo === install === && $(MAKE) -C $(TOPDIR) install || exit $$?; \
43         if [ -x $(TAR) ]; then \
44             ( echo "=== tar ===" && $(MAKEF) -C tar $@ || exit $$? ); \
45         fi; \
46         if [ -x $(RPMBUILD) ]; then \
47             ( echo "=== rpm ===" && $(MAKEF) -C rpm $@ || exit $$? ); \
48         fi; \
49         test -z "$$KEEP_DIST_ROOT" || rm -rf $$DIST_ROOT; echo Done