xref: /netbsd-src/external/gpl3/binutils.old/dist/gprofng/src/Makefile.am (revision c42dbd0ed2e61fe6eda8590caa852ccf34719964)
1## Process this file with automake to generate Makefile.in
2#
3#   Copyright (C) 2021 Free Software Foundation, Inc.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; see the file COPYING3.  If not see
17# <http://www.gnu.org/licenses/>.
18
19AUTOMAKE_OPTIONS = foreign
20ACLOCAL_AMFLAGS = -I . -I .. -I ../..
21
22CCSOURCES = \
23	Application.cc \
24	BaseMetric.cc \
25	BaseMetricTreeNode.cc \
26	CallStack.cc \
27	CatchOutOfMemory.cc \
28	ClassFile.cc \
29	Command.cc \
30	CompCom.cc \
31	DataObject.cc \
32	DataSpace.cc \
33	Data_window.cc \
34	DataStream.cc \
35	DbeApplication.cc \
36	DbeFile.cc \
37	DbeJarFile.cc \
38	DbeLock.cc \
39	DbeSession.cc \
40	DbeThread.cc \
41	DbeView.cc \
42	DerivedMetrics.cc \
43	Disasm.cc \
44	Dwarf.cc \
45	DwarfLib.cc \
46	Elf.cc \
47	Emsg.cc \
48	Experiment.cc \
49	Exp_Layout.cc \
50	ExpGroup.cc \
51	Expression.cc \
52	FileData.cc \
53	Filter.cc \
54	FilterSet.cc \
55	Function.cc \
56	HeapMap.cc \
57	HeapData.cc \
58	HeapActivity.cc \
59	Hist_data.cc \
60	IndexObject.cc \
61	IOActivity.cc \
62	LoadObject.cc \
63	MachineModel.cc \
64	MemObject.cc \
65	MemorySpace.cc \
66	Metric.cc \
67	MetricList.cc \
68	Module.cc \
69	Ovw_data.cc \
70	PRBTree.cc \
71	PathTree.cc \
72	PreviewExp.cc \
73	Print.cc \
74	SAXParserFactory.cc \
75	Sample.cc \
76	Settings.cc \
77	SourceFile.cc \
78	Stabs.cc \
79	Stats_data.cc \
80	StringBuilder.cc \
81	Table.cc \
82	QLParser.tab.cc \
83	dbe_collctrl.cc \
84	i18n.cc \
85	parse.cc \
86	UserLabel.cc \
87	util.cc \
88	Dbe.cc \
89	$(NULL)
90
91CSOURCES = \
92	dbe_hwcdrv.c \
93	dbe_hwcfuncs.c \
94	dbe_hwctable.c \
95	dbe_memmgr.c \
96	gethrtime.c \
97	$(NULL)
98
99LIBGPROFNG = libgprofng.la
100
101# This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
102# -I../zlib, unless we were configured with --with-system-zlib, in which
103# case both are empty.
104ZLIB = @zlibdir@ -lz
105ZLIBINC = @zlibinc@
106
107LOCALEDIR = @localedir@
108SYSCONFDIR = @sysconfdir@
109
110AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -DLOCALEDIR=\"$(LOCALEDIR)\" \
111	-DSYSCONFDIR=\"$(SYSCONFDIR)\" \
112	-I.. -I$(srcdir) \
113	-I$(srcdir)/../common \
114	-I$(srcdir)/../../include -I$(srcdir)/../../opcodes \
115	-I../../bfd -I$(srcdir)/../../bfd $(ZLIBINC)
116AM_CFLAGS = $(GPROFNG_CFLAGS) $(PTHREAD_CFLAGS) \
117	$(GPROFNG_NO_SWITCH_CFLAGS)
118AM_CXXFLAGS = $(AM_CFLAGS)
119
120QLParser.tab.cc QLParser.tab.hh: QLParser.yy
121	$(BISON) $^
122
123BUILT_SOURCES = QLParser.tab.hh
124EXTRA_DIST = QLParser.yy $(man_MANS)
125
126
127pkglib_LTLIBRARIES = $(LIBGPROFNG)
128libgprofng_la_SOURCES = $(CCSOURCES) $(CSOURCES)
129libgprofng_la_LDFLAGS = -version-info 0:0:0
130
131# Pass -lpthread instead of $(PTHREAD_LIBS) due to $(PTHREAD_LIBS) being empty
132# when -nostdlib is passed to libtool.
133# See bug 29364 - libgprofng.so: needs to link against -pthread
134libgprofng_la_LIBADD = $(top_builddir)/../opcodes/libopcodes.la \
135	$(top_builddir)/../bfd/libbfd.la \
136	$(GPROFNG_LIBADD) \
137	-lpthread -ldl
138
139dbedir = $(SYSCONFDIR)
140dbe_DATA = $(srcdir)/gprofng.rc
141
142
143bin_PROGRAMS = gp-archive gp-collect-app gprofng gp-display-text gp-display-src
144
145gp_archive_SOURCES = gp-archive.cc ArchiveExp.cc
146gp_archive_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
147
148gp_collect_app_SOURCES = gp-collect-app.cc checks.cc envsets.cc count.cc
149gp_collect_app_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
150
151gprofng_SOURCES = gprofng.cc
152gprofng_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
153
154gp_display_src_SOURCES = gp-display-src.cc
155gp_display_src_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
156
157gp_display_text_SOURCES = gp-display-text.cc ipc.cc ipcio.cc
158gp_display_text_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) $(ZLIB)
159
160
161if BUILD_MAN
162
163man_MANS = gprofng.1 \
164	gp-archive.1 \
165	gp-collect-app.1 \
166	gp-display-src.1 \
167	gp-display-text.1
168
169MAINTAINERCLEANFILES = $(man_MANS)
170
171# The man pages depend on the version number and on a help2man include file.
172common_mandeps = $(top_srcdir)/../bfd/version.m4
173
174# Use -o so that the `missing' program can infer the output file.
175# Embolden subcommand names in the output, and include a SEE ALSO.
176# Arrange to regenerate the output if we have help2man, but leave the
177# disted output there otherwise.
178# Some extra annoying complexity is in place so that people without
179# help2man dno't accidentally overwrite the manpage.
180
181INFO_PAGE            = "gprofng"
182MANUAL               = "User Commands"
183TEXT_GPROFNG         = "the driver for the gprofng tool suite"
184TEXT_GP_ARCHIVE      = "archive gprofng experiment data"
185TEXT_GP_COLLECT_APP  = "collect performance data for the target application"
186TEXT_GP_DISPLAY_SRC  = "display the source code, optionally interleaved with the disassembly of the target object"
187TEXT_GP_DISPLAY_TEXT = "display the performance data in plain text format"
188
189HELP2MAN_OPT = --libtool --no-info --info-page=$(INFO_PAGE) --manual=$(MANUAL)
190H2M_FILTER = | sed 's/\.TP/\.TP\n.B/' | sed 's/Commands:/\.SH COMMANDS/' \
191  | sed 's/See also:/\.SH SEE ALSO/' | sed 's/Documentation:/.SH DOCUMENTATION/' \
192  | sed 's/Limitations:/.SH LIMITATIONS/'
193
194gprofng.1: $(srcdir)/gprofng.cc $(common_mandeps) | ./gprofng$(EXEEXT)
195	$(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
196	  --name=$(TEXT_GPROFNG) ./gprofng$(EXEEXT) $(H2M_FILTER) > $@
197
198gp-archive.1: $(srcdir)/gp-archive.cc $(common_mandeps) | ./gp-archive$(EXEEXT)
199	$(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
200	  --name=$(TEXT_GP_ARCHIVE) ./gp-archive$(EXEEXT) $(H2M_FILTER) > $@
201
202gp-collect-app.1: $(srcdir)/gp-collect-app.cc $(common_mandeps) | ./gp-collect-app$(EXEEXT)
203	$(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
204	  --name=$(TEXT_GP_COLLECT_APP) ./gp-collect-app$(EXEEXT) $(H2M_FILTER) > $@
205
206gp-display-src.1: $(srcdir)/gp-display-src.cc $(srcdir)/Command.cc \
207		$(common_mandeps) | ./gp-display-src$(EXEEXT)
208	$(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
209	  --name=$(TEXT_GP_DISPLAY_SRC) ./gp-display-src$(EXEEXT) $(H2M_FILTER) > $@
210
211gp-display-text.1: $(srcdir)/gp-display-text.cc $(srcdir)/Command.cc \
212		$(common_mandeps) | ./gp-display-text$(EXEEXT)
213	$(AM_V_GEN)_BUILDING_MANPAGE=1 $(HELP2MAN) $(HELP2MAN_OPT) \
214	  --name=$(TEXT_GP_DISPLAY_TEXT) ./gp-display-text$(EXEEXT) $(H2M_FILTER) > $@
215
216endif
217
218# Distribution involves building the binaries to generate the manpage,
219# so ensure that the necessary libraries are built at dist time.
220dist-hook: $(LIBGPROFNG)
221
222.PHONY: install-data-local
223
224install-data-local: install-pkglibLTLIBRARIES
225	rm -f $(DESTDIR)/$(pkglibdir)/*.la $(DESTDIR)/$(pkglibdir)/*.a
226