Fix build with binutils-gold (ticket #107)
[platform/upstream/rpm.git] / Makefile.am
1 # Top level Makefile for rpm
2
3 ACLOCAL_AMFLAGS = -I m4
4
5 DISTCHECK_CONFIGURE_FLAGS = --with-external-db
6
7 include $(top_srcdir)/rpm.am
8
9 CLEANFILES =
10 EXTRA_DIST = CHANGES ChangeLog CREDITS GROUPS INSTALL \
11         autodeps autogen.sh \
12         db3/configure installplatform platform.in
13 BUILT_SOURCES =
14
15 SUBDIRS = po misc
16 if WITH_INTERNAL_DB
17 SUBDIRS += db3
18 endif
19 if WITH_LUAEXT
20 SUBDIRS += luaext
21 endif
22 SUBDIRS += rpmio lib build python scripts doc . tests
23
24 DIST_SUBDIRS = po misc luaext rpmio lib build python scripts doc tests
25
26 pkgconfigdir = $(libdir)/pkgconfig
27
28 AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/include/
29 AM_CPPFLAGS += -I$(top_srcdir)/build
30 AM_CPPFLAGS += -I$(top_srcdir)/lib
31 AM_CPPFLAGS += -I$(top_srcdir)/rpmio
32 AM_CPPFLAGS += @WITH_NSS_INCLUDE@
33 AM_CPPFLAGS += @WITH_POPT_INCLUDE@
34 AM_CPPFLAGS += -I$(top_srcdir)/misc
35 AM_CPPFLAGS += @WITH_LIBELF_INCLUDE@
36 AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\""
37 AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"rpmpopt-${VERSION}\""
38
39 pkginclude_HEADERS =
40 nodist_pkginclude_HEADERS =
41
42 pkginclude_HEADERS += rpmio/argv.h
43 pkginclude_HEADERS += rpmio/rpmio.h
44 pkginclude_HEADERS += rpmio/rpmurl.h
45 pkginclude_HEADERS += rpmio/rpmmacro.h
46 pkginclude_HEADERS += rpmio/rpmlog.h
47 pkginclude_HEADERS += rpmio/rpmpgp.h
48 pkginclude_HEADERS += rpmio/rpmsq.h
49 pkginclude_HEADERS += rpmio/rpmstring.h
50 pkginclude_HEADERS += rpmio/rpmsw.h
51 pkginclude_HEADERS += rpmio/rpmfileutil.h
52 pkginclude_HEADERS += rpmio/rpmutil.h
53 pkginclude_HEADERS += rpmio/rpmkeyring.h
54
55 pkginclude_HEADERS += lib/header.h
56 pkginclude_HEADERS += lib/rpmdb.h
57 pkginclude_HEADERS += lib/rpmcallback.h
58 pkginclude_HEADERS += lib/rpmcli.h
59 pkginclude_HEADERS += lib/rpmlib.h
60 pkginclude_HEADERS += lib/rpmds.h
61 pkginclude_HEADERS += lib/rpmfi.h
62 pkginclude_HEADERS += lib/rpmgi.h
63 pkginclude_HEADERS += lib/rpmlegacy.h
64 pkginclude_HEADERS += lib/rpmps.h
65 pkginclude_HEADERS += lib/rpmtag.h
66 pkginclude_HEADERS += lib/rpmtd.h
67 pkginclude_HEADERS += lib/rpmte.h
68 pkginclude_HEADERS += lib/rpmts.h
69 pkginclude_HEADERS += lib/rpmtypes.h
70 pkginclude_HEADERS += lib/rpmvf.h
71
72 pkginclude_HEADERS += build/rpmbuild.h
73 pkginclude_HEADERS += build/rpmfc.h
74 pkginclude_HEADERS += build/rpmspec.h
75
76
77 rpmbindir = `echo $(bindir) | $(SED) -e s,usr/bin,bin,`
78 rpmbin_PROGRAMS = rpm
79
80 bin_PROGRAMS =          rpm2cpio rpmbuild
81
82 rpmlibexec_PROGRAMS =
83 rpmconfig_SCRIPTS =     find-provides find-requires mkinstalldirs \
84                         config.guess config.sub
85 DISTCLEANFILES = find-provides
86 DISTCLEANFILES += find-requires
87
88 rpm_SOURCES =           rpmqv.c debug.h system.h
89 rpm_CPPFLAGS =          $(AM_CPPFLAGS) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV
90 rpm_LDADD =             build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
91 rpm_LDADD +=            @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
92
93 rpmbuild_SOURCES =      build.c rpmqv.c build.h debug.h system.h
94 rpmbuild_CPPFLAGS =     $(AM_CPPFLAGS) -DIAM_RPMBT
95 rpmbuild_LDADD =        build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
96 rpmbuild_LDADD +=       @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
97
98 rpm2cpio_SOURCES =      rpm2cpio.c debug.h system.h
99 rpm2cpio_LDADD =        lib/librpm.la rpmio/librpmio.la
100 rpm2cpio_LDADD +=       @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
101
102
103 if LIBELF
104 if LIBDWARF
105 rpmconfig_SCRIPTS += scripts/find-debuginfo.sh
106
107 rpmlibexec_PROGRAMS +=  debugedit
108 debugedit_SOURCES =     tools/debugedit.c tools/hashtab.c tools/hashtab.h
109 debugedit_LDADD =       rpmio/librpmio.la
110 debugedit_LDADD +=      @WITH_LIBELF_LIB@ @WITH_POPT_LIB@
111 endif
112 endif
113
114 rpmlibexec_PROGRAMS +=  javadeps
115 javadeps_SOURCES =      tools/javadeps.c
116 javadeps_LDADD =
117
118 rpmlibexec_PROGRAMS +=  rpmdeps
119 rpmdeps_SOURCES =       tools/rpmdeps.c
120 rpmdeps_LDADD =         lib/librpm.la rpmio/librpmio.la build/librpmbuild.la @WITH_POPT_LIB@
121
122 bin_PROGRAMS +=         rpmgraph
123 rpmgraph_SOURCES =      tools/rpmgraph.c
124 rpmgraph_LDADD =        lib/librpm.la rpmio/librpmio.la @WITH_POPT_LIB@
125
126 dist_bin_SCRIPTS =      scripts/gendiff
127
128 check_PROGRAMS =        rpminject
129 rpminject_SOURCES =     tools/rpminject.c
130 rpminject_LDADD =       build/librpmbuild.la
131
132 check_PROGRAMS +=       rpmsort
133 rpmsort_SOURCES =       tools/rpmsort.c
134 rpmsort_LDADD =         lib/librpm.la
135
136 rpmconfig_DATA = rpmrc
137 rpmrc: $(top_srcdir)/rpmrc.in
138         @$(SED) \
139           -e "s,[@]SYSCONFIGDIR[@],$(sysconfdir)/rpm,g" \
140           < $(top_srcdir)/rpmrc.in > rpmrc.tmp \
141           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmrc:${subdir}/rpmrc.tmp )
142 CLEANFILES += rpmrc.tmp rpmrc
143 EXTRA_DIST += rpmrc.in
144
145 rpmconfig_DATA += macros
146 macros: $(top_srcdir)/macros.in
147           ( cd $(top_builddir) && ./config.status --file=${subdir}/macros:${subdir}/macros.in )
148 CLEANFILES += macros
149 EXTRA_DIST += macros.in
150
151 noinst_DATA = platform
152 platform: $(top_srcdir)/platform.in
153         @$(SED) \
154           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
155           < $(top_srcdir)/platform.in > platform.tmp \
156           && ( cd $(top_builddir) && ./config.status --file=${subdir}/platform:${subdir}/platform.tmp )
157 CLEANFILES += platform.tmp platform
158 EXTRA_DIST += platform.in
159
160 pkgconfig_DATA = rpm.pc
161 rpm.pc: $(top_srcdir)/rpm.pc.in
162         @$(SED) \
163           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
164           < $(top_srcdir)/rpm.pc.in > rpm.pc.tmp \
165           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpm.pc:${subdir}/rpm.pc.tmp )
166 CLEANFILES += rpm.pc.tmp rpm.pc
167 EXTRA_DIST += rpm.pc.in
168
169 rpmconfig_DATA += rpmpopt-$(VERSION)
170 rpmpopt-@VERSION@: $(top_srcdir)/rpmpopt.in
171         @$(SED) \
172           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
173           < $(top_srcdir)/rpmpopt.in > rpmpopt-@VERSION@.tmp \
174           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmpopt-@VERSION@:${subdir}/rpmpopt-@VERSION@.tmp )
175 CLEANFILES += rpmpopt-@VERSION@.tmp rpmpopt-@VERSION@
176 EXTRA_DIST += rpmpopt.in
177
178 usrsrcdir = $(prefix)/src
179
180 rpmvardir = $(localstatedir)/lib/rpm
181 rpmvar_DATA =
182
183 install-exec-hook:
184         rm -f $(DESTDIR)$(bindir)/rpmquery
185         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmquery
186         rm -f $(DESTDIR)$(bindir)/rpmverify
187         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmverify
188         rm -f $(DESTDIR)$(bindir)/rpmsign
189         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmsign
190         rm -f $(DESTDIR)$(bindir)/rpmdb
191         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmdb
192
193 install-data-local:
194         @case "@host_os@" in \
195         solaris*|linux*|darwin*) \
196            DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" $(SHELL) $(top_srcdir)/installplatform rpmrc macros platform ;; \
197         esac
198         @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp
199
200 # XXX to appease distcheck we need to remove "stuff" here...
201 uninstall-local:
202         @rm -f $(DESTDIR)$(bindir)/rpmquery
203         @rm -f $(DESTDIR)$(bindir)/rpmsign
204         @rm -f $(DESTDIR)$(bindir)/rpmverify
205         @rm -f $(DESTDIR)$(bindir)/rpmdb
206         @rm -rf $(DESTDIR)$(rpmconfigdir)/platform/
207
208 MAINTAINERCLEANFILES = ChangeLog
209
210 # Build hacking docs only on request
211 if HACKINGDOCS
212 if DOXYGEN
213 doc/hacking.doxy: doc/hacking.doxy.in doc/hacking/Doxyheader Makefile.am
214         $(SED) \
215           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
216           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
217           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
218           -e "s,[@]VERSION[@],$(VERSION)," \
219         < $(top_srcdir)/doc/hacking.doxy.in > doc/hacking.doxy
220
221 doc/hacking/html/index.html: doc/hacking.doxy rpmpopt-@VERSION@
222         @DOXYGEN@ doc/hacking.doxy
223 noinst_DATA += doc/hacking/html/index.html
224 endif
225 endif
226 EXTRA_DIST += doc/hacking.doxy.in doc/hacking/Doxyheader
227
228 # Always build librpm docs
229 if DOXYGEN
230 doc/librpm.doxy: doc/librpm.doxy.in doc/librpm/Doxyheader Makefile.am $(pkginclude_HEADERS)
231         files=`echo " $(HEADERS)" | $(SED) -e "s, , \@top_srcdir\@/,g"`; \
232         $(SED) -e "s,[@]pkginclude_HEADERS[@],$$files," \
233           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
234           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
235           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
236           -e "s,[@]VERSION[@],$(VERSION)," \
237         < $(top_srcdir)/doc/librpm.doxy.in > doc/librpm.doxy
238
239 doc/librpm/html/index.html: doc/librpm.doxy
240         @DOXYGEN@ doc/librpm.doxy
241 noinst_DATA += doc/librpm/html/index.html
242 endif
243 EXTRA_DIST += doc/librpm.doxy.in doc/librpm/Doxyheader
244 EXTRA_DIST += doc/librpm/html
245
246 if WITH_INTERNAL_DB
247 db.h:   $(top_builddir)/db3/db.h
248         $(LN_S) $(top_builddir)/db3/db.h $@
249 BUILT_SOURCES += db.h
250 endif
251 DISTCLEANFILES += db.h
252
253 clean-local:
254         rm -rf doc/hacking/html
255         rm -rf include
256
257 distclean-local:
258         rm -rf Doxytags
259         rm -f stamp-h.in db3/*.orig db3/db3lobjs
260
261 maintainer-clean-local:
262         rm -rf doc/librpm/html
263
264 $(top_srcdir)/preinstall.am: Makefile.am
265         rm -f $(top_srcdir)/preinstall.am
266         @for f in $(HEADERS); do \
267           b=`basename $$f`; \
268           echo 'include/rpm/'$$b': '$$f' include/rpm/$$(dirstamp)' >> $(top_srcdir)/preinstall.am;\
269           echo '        $$(INSTALL_DATA) $$(top_srcdir)/'$$f' include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
270           echo 'BUILT_SOURCES += include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
271           echo 'CLEANFILES += include/rpm/'$$b  >> $(top_srcdir)/preinstall.am; \
272          done
273
274 include/rpm/$(dirstamp):
275         @$(MKDIR_P) include/rpm
276         @: > include/rpm/$(dirstamp)
277
278 include $(top_srcdir)/preinstall.am