forked from msasongko17/hpctoolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
218 lines (189 loc) · 7.51 KB
/
Makefile.am
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# -*-Mode: makefile;-*-
## * BeginRiceCopyright *****************************************************
##
## $HeadURL$
## $Id$
##
## --------------------------------------------------------------------------
## Part of HPCToolkit (hpctoolkit.org)
##
## Information about sources of support for research and development of
## HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
## --------------------------------------------------------------------------
##
## Copyright ((c)) 2002-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.
##
## ******************************************************* EndRiceCopyright *
#############################################################################
##
## File:
## $HeadURL$
##
## Description:
## *Process with automake to produce Makefile.in*
##
## Note: All local variables are prefixed with MY to prevent name
## clashes with automatic automake variables.
##
#############################################################################
# We do not want the standard GNU files (NEWS README AUTHORS ChangeLog...)
AUTOMAKE_OPTIONS = foreign no-dist
#############################################################################
# Local settings
#############################################################################
MYDATA = \
README \
README.License \
README.ReleaseNotes \
README.Acknowledgments
MYSCRIPTS = \
config/hpcguess \
config/hpcplatform \
config/config.guess
#############################################################################
# Automake rules
#############################################################################
pkglibdir = @my_pkglibdir@
pkglibexecdir = @my_pkglibexecdir@
SUBDIRS = src
if OPT_BUILD_FRONT_END
SUBDIRS += \
doc \
lib
pkglibexec_SCRIPTS = $(MYSCRIPTS)
dist_doc_DATA = $(MYDATA)
endif
#############################################################################
# Other rules
#############################################################################
############################################################
# Install
############################################################
# Note: *-local and *-hook are special automake versions of the
# regular target. *-hook runs *after* install has completed
#
# Copy the libraries in pattern ($3) from absolute directory ($2) to a
# local directory below prefix, and do the copy if ($1) is 'yes'.
# It's up to configure to decide if the library exists, whether to
# copy it and where to put it, so we don't treat errors as fatal here.
#
BASE_LIBS_DIR = $(DESTDIR)$(pkglibdir)
EXT_LIBS_DIR = $(DESTDIR)$(pkglibdir)/ext-libs
define copy-libs
if test "$1" = yes ; then \
( cd "$2" && tar cf - $3 2>/dev/null ) | ( cd "$(EXT_LIBS_DIR)" && tar xvf - ) ; \
true ; \
fi
endef
hash_file = $(BASE_LIBS_DIR)/hash-file
hash_value = @hash_value@
install-exec-local:
@echo "Installing launch script hash ..."
rm -f "$(hash_file)"
echo "$(hash_value)" > "$(hash_file)"
@echo "Copying external package libraries ..."
@$(mkinstalldirs) "$(EXT_LIBS_DIR)"
@for lib in $(BOOST_COPY_LIST) ; do \
$(call copy-libs,$(BOOST_COPY),$(BOOST_LIB_DIR),libboost_"$$lib"*so*) ; \
done
@$(call copy-libs,$(BZIP_COPY),$(BZIP_LIB),libbz*so*)
@for lib in common dynElf dynDwarf instructionAPI parseAPI symtabAPI ; do \
$(call copy-libs,$(DYNINST_COPY),$(DYNINST_LIB_DIR),lib"$$lib"*so*) ; \
done
@$(call copy-libs,$(LIBELF_COPY),$(LIBELF_LIB),libelf*so*)
@$(call copy-libs,$(LIBELF_COPY),$(LIBELF_LIB),libdw*so*)
@$(call copy-libs,$(LIBDWARF_COPY),$(LIBDWARF_LIB),libdwarf*so*)
@$(call copy-libs,$(LIBMONITOR_COPY),$(LIBMONITOR_LIB),libmonitor*)
@$(call copy-libs,$(PERFMON_COPY),$(PERFMON_LIB),libpfm.so*)
@$(call copy-libs,$(LIBUNWIND_COPY),$(LIBUNWIND_LIB),libunwind.so*)
@$(call copy-libs,$(LZMA_COPY),$(LZMA_LIB),liblzma.so*)
@$(call copy-libs,$(LZMA_COPY),$(LZMA_LIB),liblzma.a*)
@$(call copy-libs,$(TBB_COPY),$(TBB_LIB_DIR),libtbb.so*)
@$(call copy-libs,$(TBB_COPY),$(TBB_LIB_DIR),libtbbmalloc.so*)
@$(call copy-libs,$(TBB_COPY),$(TBB_LIB_DIR),libtbbmalloc_proxy.so*)
@$(call copy-libs,$(XED2_COPY),$(XED2_LIB_DIR),lib*)
@$(call copy-libs,$(XERCES_COPY),$(XERCES_LIB),libxerces*)
@$(call copy-libs,$(ZLIB_COPY),$(ZLIB_LIB),libz.a libz.so*)
#
# Strip the debug sections from the libraries (ours and externals)
# used in hpcrun and hpclink. This prevents our code from being
# displayed in the viewer.
#
# $1 = directory containing the libraries
# $2 = glob pattern for library name
#
define strip-debug
if cd "$1" 2>/dev/null ; then \
for lib in $2 ; do \
if test -f "$$lib" && test ! -L "$$lib" ; then \
echo "$$lib" ; \
objcopy --strip-debug "$$lib" ; \
fi ; \
true ; \
done ; \
fi
endef
if OPT_STRIP_HPCRUN_LIBS
install-exec-hook:
@echo "Strip debug sections from hpcrun libraries ..."
@$(call strip-debug,$(BASE_LIBS_DIR),libhpcrun*.so*)
@$(call strip-debug,$(BASE_LIBS_DIR),libhpcrun.o)
@$(call strip-debug,$(BASE_LIBS_DIR),libhpcrun*wrap*.a)
@$(call strip-debug,$(BASE_LIBS_DIR),libhpctoolkit.so*)
@$(call strip-debug,$(BASE_LIBS_DIR),libhpctoolkit.a)
@$(call strip-debug,$(EXT_LIBS_DIR),libmonitor.so*)
@$(call strip-debug,$(EXT_LIBS_DIR),libmonitor_wrap.a)
@$(call strip-debug,$(EXT_LIBS_DIR),libunwind*.so*)
@$(call strip-debug,$(EXT_LIBS_DIR),liblzma*.so*)
@$(call strip-debug,$(EXT_LIBS_DIR),libpfm.so*)
endif
############################################################
# Dist
############################################################
DIST_FILES = Makefile* README* aclocal.m4 autogen configure* \
config doc lib src tools
MY_DIST_DIR = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
MY_TAR_FILE = $(MY_DIST_DIR).tar
SRCDIR = @srcdir@
dist hpc-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 \
$(addprefix $(MY_DIST_DIR)/,$(DIST_FILES))
rm -f "$(MY_DIST_DIR)"
gzip "$(MY_TAR_FILE)"
@ls -l "$(MY_TAR_FILE).gz"
.PHONY: dist hpc-dist
############################################################