forked from HPCToolkit/hpctoolkit-externals
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.in
155 lines (136 loc) · 4.7 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# Externals Makefile.
#
# Copyright (c) 2008-2019, Rice University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of Rice University (RICE) nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# This software is provided by RICE and contributors "as is" and any
# express or implied warranties, including, but not limited to, the
# implied warranties of merchantability and fitness for a particular
# purpose are disclaimed. In no event shall RICE or contributors be
# liable for any direct, indirect, incidental, special, exemplary, or
# consequential damages (including, but not limited to, procurement of
# substitute goods or services; loss of use, data, or profits; or
# business interruption) however caused and on any theory of liability,
# whether in contract, strict liability, or tort (including negligence
# or otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
#
# $Id$
#
NAME = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
TARNAME = @PACKAGE_TARNAME@
PREFIX = @prefix@
BACK_END_PKGS = boost libdwarf libelf libmonitor libunwind libxml2 \
lzma symtabAPI xed2
PACKAGES = $(BACK_END_PKGS) \
binutils old-monitor open-analysis oprofile perfmon xerces zlib
DIST_FILES = LICENSE Makefile.conf.in Makefile.in README* \
configure configure.ac externs.conf.in options.conf.in \
autogen build-utils config distfiles
NOBUILD_COOKIE = .dont-build
EXTERNS_FILE = externs.conf
FAILURE_FILE = BUILD-FAILURE
.PHONY: all install install-all back-end backend
.PHONY: fetch fetch-all clean clean-all
.PHONY: distclean distclean-all distclean-plus dist
.PHONY: pre-build post-build
.PHONY: $(PACKAGES)
all install install-all: pre-build $(PACKAGES)
$(MAKE) post-build
@echo "Externals build complete at `date`"
back-end backend: pre-build $(BACK_END_PKGS)
$(MAKE) post-build
@echo "Externals back-end build complete at `date`"
libdwarf: libelf zlib
libelf: zlib
libunwind: lzma
oprofile: binutils
symtabAPI: binutils boost libelf
#
# Catch package failures and save them in FAILURE_FILE. This allows
# us to report the failure after a successful target. Externals's
# top-level targets are entire package builds, so the output in a
# parallel build often hides the error from another package.
#
pre-build:
@rm -f $(FAILURE_FILE)
post-build:
@if test -f $(FAILURE_FILE) ; then \
echo "BUILD FAILURE in the following packages:" ; \
cat $(FAILURE_FILE) ; \
fi
@-if test ! -f "$(PREFIX)/$(EXTERNS_FILE)" ; then \
echo "reinstall $(EXTERNS_FILE) ..." ; \
cp "$(EXTERNS_FILE)" "$(PREFIX)/$(EXTERNS_FILE)" ; \
fi
$(PACKAGES): pre-build
@if $(MAKE) -C $@ install ; then : ; else \
echo $@ >>$(FAILURE_FILE) ; \
echo "BUILD FAILURE:" $@ ; \
exit 2 ; \
fi
$(MAKE) post-build
fetch fetch-all:
@for pkg in $(PACKAGES) ; do \
$(MAKE) -C $$pkg fetch || exit 2 ; \
done
clean clean-all:
@for pkg in $(PACKAGES) ; do \
$(MAKE) -C $$pkg clean ; \
done
#
# We use distclean to undo everything in each package directory but
# leave the top-level configure intact, and use distclean-plus to
# also erase the top-level files. The no-build cookies are part of
# the top-level configure.
#
# Also, externs.conf is part of the install, so never delete it.
#
distclean distclean-all:
@for pkg in $(PACKAGES) ; do \
$(MAKE) -C $$pkg distclean ; \
done
distclean-plus: distclean-all
@for pkg in $(PACKAGES) ; do \
rm -f "$$pkg/$(NOBUILD_COOKIE)" ; \
done
rm -f config.log config.status options.conf
rm -f Makefile.conf Makefile
#
# Make a tar file of the source tree.
#
MY_DIST_DIR = $(TARNAME)-$(VERSION)
MY_TAR_FILE = $(TARNAME)-$(VERSION).tar
SRCDIR = @srcdir@
dist:
@echo "cleaning source tree (ignore errors) ..."
-cd "$(SRCDIR)" && test -f Makefile && $(MAKE) clean
rm -f "$(MY_DIST_DIR)" "$(MY_TAR_FILE)" "$(MY_TAR_FILE).gz"
ln -s "$(SRCDIR)" "$(MY_DIST_DIR)"
tar cf "$(MY_TAR_FILE)" \
--exclude .git \
--exclude .svn \
--exclude '.*-done' \
--exclude $(NOBUILD_COOKIE) \
$(addprefix $(MY_DIST_DIR)/,$(PACKAGES)) \
$(addprefix $(MY_DIST_DIR)/,$(DIST_FILES))
rm -f "$(MY_DIST_DIR)"
gzip "$(MY_TAR_FILE)"
@ls -l "$(MY_TAR_FILE).gz"