1## ltdl.mk -- includable Makefile snippet
2##
3##   Copyright (C) 2003-2005, 2007, 2011-2015 Free Software Foundation,
4##   Inc.
5##   Written by Gary V. Vaughan, 2003
6##
7##   NOTE: The canonical source of this file is maintained with the
8##   GNU Libtool package.  Report bugs to bug-libtool@gnu.org.
9##
10## GNU Libltdl is free software; you can redistribute it and/or
11## modify it under the terms of the GNU Lesser General Public
12## License as published by the Free Software Foundation; either
13## version 2 of the License, or (at your option) any later version.
14##
15## As a special exception to the GNU Lesser General Public License,
16## if you distribute this file as part of a program or library that
17## is built using GNU libtool, you may include this file under the
18## same distribution terms that you use for the rest of that program.
19##
20## GNU Libltdl is distributed in the hope that it will be useful,
21## but WITHOUT ANY WARRANTY; without even the implied warranty of
22## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23## GNU Lesser General Public License for more details.
24##
25## You should have received a copy of the GNU LesserGeneral Public
26## License along with GNU Libltdl; see the file COPYING.LIB.  If not, a
27## copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
28## or obtained by writing to the Free Software Foundation, Inc.,
29## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30#####
31
32ACLOCAL_AMFLAGS = -I ../m4
33AUTOMAKE_OPTIONS = foreign
34AM_CPPFLAGS =
35AM_LDFLAGS =
36BUILT_SOURCES =
37include_HEADERS =
38noinst_LTLIBRARIES =
39lib_LTLIBRARIES =
40EXTRA_LTLIBRARIES =
41EXTRA_DIST =
42CLEANFILES =
43MOSTLYCLEANFILES =
44
45# -I$(srcdir) is needed for user that built libltdl with a sub-Automake
46# (not as a sub-package!) using 'nostdinc':
47AM_CPPFLAGS	       += -DLT_CONFIG_H='<$(LT_CONFIG_H)>' \
48			  -DLTDL -I. -I$(srcdir) -Ilibltdl \
49			  -I$(srcdir)/libltdl
50AM_LDFLAGS	       += -no-undefined
51LTDL_VERSION_INFO	= -version-info 10:1:3
52
53noinst_LTLIBRARIES	+= $(LT_DLLOADERS)
54
55if INSTALL_LTDL
56ltdlincludedir		= $(includedir)/libltdl
57ltdlinclude_HEADERS	= libltdl/lt_system.h \
58			  libltdl/lt_error.h \
59			  libltdl/lt_dlloader.h
60include_HEADERS	       += ltdl.h
61lib_LTLIBRARIES	       += libltdl.la
62endif
63
64if CONVENIENCE_LTDL
65noinst_LTLIBRARIES     += libltdlc.la
66endif
67
68libltdl_la_SOURCES = libltdl/lt__alloc.h \
69			  libltdl/lt__dirent.h \
70			  libltdl/lt__glibc.h \
71			  libltdl/lt__private.h \
72			  libltdl/lt__strl.h \
73			  libltdl/lt_dlloader.h \
74			  libltdl/lt_error.h \
75			  libltdl/lt_system.h \
76			  libltdl/slist.h \
77			  loaders/preopen.c \
78			  lt__alloc.c \
79			  lt_dlloader.c \
80			  lt_error.c \
81			  ltdl.c \
82			  ltdl.h \
83			  slist.c
84
85EXTRA_DIST	       += lt__dirent.c \
86			  lt__strl.c
87
88libltdl_la_CPPFLAGS	= -DLTDLOPEN=$(LTDLOPEN) $(AM_CPPFLAGS)
89libltdl_la_LDFLAGS	= $(AM_LDFLAGS) $(LTDL_VERSION_INFO) $(LT_DLPREOPEN)
90libltdl_la_LIBADD	= $(LTLIBOBJS)
91libltdl_la_DEPENDENCIES	= $(LT_DLLOADERS) $(LTLIBOBJS)
92
93libltdlc_la_SOURCES	= $(libltdl_la_SOURCES)
94libltdlc_la_CPPFLAGS	= -DLTDLOPEN=$(LTDLOPEN)c $(AM_CPPFLAGS)
95libltdlc_la_LDFLAGS	= $(AM_LDFLAGS) $(LT_DLPREOPEN)
96libltdlc_la_LIBADD	= $(libltdl_la_LIBADD)
97libltdlc_la_DEPENDENCIES= $(libltdl_la_DEPENDENCIES)
98
99## The loaders are preopened by libltdl, itself always built from
100## pic-objects (either as a shared library, or a convenience library),
101## so the loaders themselves must be made from pic-objects too.  We
102## use convenience libraries for that purpose:
103EXTRA_LTLIBRARIES	       += dlopen.la \
104				  dld_link.la \
105				  dyld.la \
106				  load_add_on.la \
107				  loadlibrary.la \
108				  shl_load.la
109
110dlopen_la_SOURCES	= loaders/dlopen.c
111dlopen_la_LDFLAGS	= -module -avoid-version
112dlopen_la_LIBADD	= $(LIBADD_DLOPEN)
113
114dld_link_la_SOURCES	= loaders/dld_link.c
115dld_link_la_LDFLAGS	= -module -avoid-version
116dld_link_la_LIBADD	= -ldld
117
118dyld_la_SOURCES		= loaders/dyld.c
119dyld_la_LDFLAGS		= -module -avoid-version
120
121load_add_on_la_SOURCES	= loaders/load_add_on.c
122load_add_on_la_LDFLAGS	= -module -avoid-version
123
124loadlibrary_la_SOURCES	= loaders/loadlibrary.c
125loadlibrary_la_LDFLAGS	= -module -avoid-version
126
127shl_load_la_SOURCES	= loaders/shl_load.c
128shl_load_la_LDFLAGS	= -module -avoid-version
129shl_load_la_LIBADD	= $(LIBADD_SHL_LOAD)
130
131## Make sure these will be cleaned even when they're not built by default:
132CLEANFILES		       += libltdl.la \
133				  libltdlc.la \
134				  libdlloader.la
135
136## Automake-1.9.6 doesn't clean subdir AC_LIBOBJ compiled objects
137## automatically:
138CLEANFILES	       += $(LIBOBJS) $(LTLIBOBJS)
139
140EXTRA_DIST	       += COPYING.LIB \
141			  README
142
143## --------------------------- ##
144## Gnulib Makefile.am snippets ##
145## --------------------------- ##
146
147BUILT_SOURCES	+= libltdl/$(LT_ARGZ_H)
148EXTRA_DIST	+= libltdl/lt__argz_.h \
149		   lt__argz.c
150
151# We need the following in order to create an <argz.h> when the system
152# doesn't have one that works with the given compiler.
153all-local $(lib_OBJECTS): $(LT_ARGZ_H)
154libltdl/lt__argz.h: libltdl/lt__argz_.h
155	$(AM_V_at)$(mkinstalldirs) . libltdl
156	$(AM_V_GEN)cp $(srcdir)/libltdl/lt__argz_.h $@-t
157	$(AM_V_at)mv $@-t $@
158MOSTLYCLEANFILES += libltdl/lt__argz.h \
159		    libltdl/lt__argz.h-t
160