Eliminate the pointless rpmb + rpmt symlinkery
[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 += -DRPMCONFIGDIR="\"@RPMCONFIGDIR@\""
38 AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"@RPMCONFIGDIR@/rpmpopt-${VERSION}\""
39
40 staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@
41
42 pkginclude_HEADERS =
43 nodist_pkginclude_HEADERS =
44
45 pkginclude_HEADERS += rpmio/argv.h
46 pkginclude_HEADERS += rpmio/rpmio.h
47 pkginclude_HEADERS += rpmio/rpmurl.h
48 pkginclude_HEADERS += rpmio/rpmmacro.h
49 pkginclude_HEADERS += rpmio/rpmlog.h
50 pkginclude_HEADERS += rpmio/rpmpgp.h
51 pkginclude_HEADERS += rpmio/rpmsq.h
52 pkginclude_HEADERS += rpmio/rpmstring.h
53 pkginclude_HEADERS += rpmio/rpmsw.h
54 pkginclude_HEADERS += rpmio/rpmfileutil.h
55 pkginclude_HEADERS += rpmio/rpmutil.h
56
57 pkginclude_HEADERS += lib/header.h
58 pkginclude_HEADERS += lib/rpmdb.h
59 pkginclude_HEADERS += lib/rpmcallback.h
60 pkginclude_HEADERS += lib/rpmcli.h
61 pkginclude_HEADERS += lib/rpmlib.h
62 pkginclude_HEADERS += lib/rpmal.h
63 pkginclude_HEADERS += lib/rpmds.h
64 pkginclude_HEADERS += lib/rpmfi.h
65 pkginclude_HEADERS += lib/rpmgi.h
66 pkginclude_HEADERS += lib/rpmps.h
67 pkginclude_HEADERS += lib/rpmtag.h
68 pkginclude_HEADERS += lib/rpmtd.h
69 pkginclude_HEADERS += lib/rpmte.h
70 pkginclude_HEADERS += lib/rpmts.h
71 pkginclude_HEADERS += lib/rpmtypes.h
72 pkginclude_HEADERS += lib/rpmvf.h
73 nodist_pkginclude_HEADERS += lib/rpmints.h
74
75 pkginclude_HEADERS += build/rpmbuild.h
76 pkginclude_HEADERS += build/rpmfc.h
77 pkginclude_HEADERS += build/rpmspec.h
78
79
80 rpmbindir = `echo $(bindir) | $(SED) -e s,usr/bin,bin,`
81 rpmbin_PROGRAMS = rpm
82
83 bin_PROGRAMS =          rpm2cpio rpmbuild
84
85 rpmlibexec_PROGRAMS =   rpmd rpmi rpmk rpmq
86 rpmconfig_SCRIPTS =     find-provides find-requires mkinstalldirs \
87                         config.guess config.sub
88 DISTCLEANFILES = find-provides
89 DISTCLEANFILES += find-requires
90
91 rpm_SOURCES =           rpmqv.c debug.h system.h
92 rpm_CPPFLAGS =          $(AM_CPPFLAGS) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV
93 rpm_LDADD =             build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
94 rpm_LDADD +=            @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
95
96 rpmbuild_SOURCES =      build.c rpmqv.c build.h debug.h system.h
97 rpmbuild_CPPFLAGS =     $(AM_CPPFLAGS) -DIAM_RPMBT
98 rpmbuild_LDADD =        build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
99 rpmbuild_LDADD +=       @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
100
101 rpmd_SOURCES =          rpmqv.c debug.h system.h
102 rpmd_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMDB
103 rpmd_LDADD =            lib/librpm.la rpmio/librpmio.la
104 rpmd_LDADD +=           @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
105
106 rpmi_SOURCES =          rpmqv.c debug.h system.h
107 rpmi_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMEIU
108 rpmi_LDADD =            lib/librpm.la rpmio/librpmio.la
109 rpmi_LDADD +=           @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
110
111 rpmk_SOURCES =          rpmqv.c debug.h system.h
112 rpmk_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMK
113 rpmk_LDADD =            lib/librpm.la rpmio/librpmio.la
114 rpmk_LDADD +=           @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
115
116 rpmq_SOURCES =          rpmqv.c debug.h system.h
117 rpmq_CPPFLAGS =         $(AM_CPPFLAGS) -DIAM_RPMQV
118 rpmq_LDADD =            build/librpmbuild.la lib/librpm.la rpmio/librpmio.la
119 rpmq_LDADD +=           @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
120
121 rpm2cpio_SOURCES =      rpm2cpio.c debug.h system.h
122 rpm2cpio_LDADD =        lib/librpm.la rpmio/librpmio.la
123 rpm2cpio_LDADD +=       @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
124
125
126 if LIBELF
127 if LIBDWARF
128 rpmconfig_SCRIPTS += scripts/find-debuginfo.sh
129
130 rpmlibexec_PROGRAMS +=  debugedit
131 debugedit_SOURCES =     tools/debugedit.c tools/hashtab.c tools/hashtab.h
132 debugedit_LDADD =       rpmio/librpmio.la
133 debugedit_LDADD +=      @WITH_LIBELF_LIB@ @WITH_POPT_LIB@
134 endif
135 endif
136
137 rpmlibexec_PROGRAMS +=  javadeps
138 javadeps_SOURCES =      tools/javadeps.c
139 javadeps_LDADD =
140
141 rpmlibexec_PROGRAMS +=  rpmcache
142 rpmcache_SOURCES =      tools/rpmcache.c
143 rpmcache_LDADD =        lib/librpm.la
144
145 rpmlibexec_PROGRAMS +=  rpmdeps
146 rpmdeps_SOURCES =       tools/rpmdeps.c
147 rpmdeps_LDADD =         build/librpmbuild.la
148
149 bin_PROGRAMS +=         rpmgraph
150 rpmgraph_SOURCES =      tools/rpmgraph.c
151 rpmgraph_LDADD =        lib/librpm.la
152
153 dist_bin_SCRIPTS =      scripts/gendiff
154
155 check_PROGRAMS =        dumpdb
156 dumpdb_SOURCES =        tools/dumpdb.c
157 dumpdb_LDADD =          lib/librpm.la
158
159 check_PROGRAMS +=       convertdb1
160 convertdb1_SOURCES =    tools/convertdb1.c
161 convertdb1_LDADD =      lib/librpm.la
162
163 check_PROGRAMS +=       rpminject
164 rpminject_SOURCES =     tools/rpminject.c
165 rpminject_LDADD =       build/librpmbuild.la
166
167 check_PROGRAMS +=       rpmsort
168 rpmsort_SOURCES =       tools/rpmsort.c
169 rpmsort_LDADD =         lib/librpm.la
170
171 rpmconfig_DATA = rpmrc
172 rpmrc: $(top_srcdir)/rpmrc.in
173         @$(SED) \
174           -e "s,[@]SYSCONFIGDIR[@],$(sysconfdir)/rpm,g" \
175           < $(top_srcdir)/rpmrc.in > rpmrc.tmp \
176           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmrc:${subdir}/rpmrc.tmp )
177 CLEANFILES += rpmrc.tmp rpmrc
178 EXTRA_DIST += rpmrc.in
179
180 rpmconfig_DATA += macros
181 macros: $(top_srcdir)/macros.in
182         @$(SED) \
183           -e "s,[@]varprefix[@],$(localstatedir),g" \
184           < $(top_srcdir)/macros.in > macros.tmp \
185           && ( cd $(top_builddir) && ./config.status --file=${subdir}/macros:${subdir}/macros.tmp )
186 CLEANFILES += macros.tmp macros
187 EXTRA_DIST += macros.in
188
189 noinst_DATA = platform
190 platform: $(top_srcdir)/platform.in
191         @$(SED) \
192           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
193           < $(top_srcdir)/platform.in > platform.tmp \
194           && ( cd $(top_builddir) && ./config.status --file=${subdir}/platform:${subdir}/platform.tmp )
195 CLEANFILES += platform.tmp platform
196 EXTRA_DIST += platform.in
197
198 pkgconfig_DATA = rpm.pc
199 rpm.pc: $(top_srcdir)/rpm.pc.in
200         @$(SED) \
201           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
202           < $(top_srcdir)/rpm.pc.in > rpm.pc.tmp \
203           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpm.pc:${subdir}/rpm.pc.tmp )
204 CLEANFILES += rpm.pc.tmp rpm.pc
205 EXTRA_DIST += rpm.pc.in
206
207 rpmconfig_DATA += rpmpopt-$(VERSION)
208 rpmpopt-@VERSION@: $(top_srcdir)/rpmpopt.in
209         @$(SED) \
210           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
211           < $(top_srcdir)/rpmpopt.in > rpmpopt-@VERSION@.tmp \
212           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmpopt-@VERSION@:${subdir}/rpmpopt-@VERSION@.tmp )
213 CLEANFILES += rpmpopt-@VERSION@.tmp rpmpopt-@VERSION@
214 EXTRA_DIST += rpmpopt.in
215
216 usrsrcdir = $(prefix)/src
217
218 rpmvardir = $(localstatedir)/lib/rpm
219 rpmvar_DATA =
220
221 install-exec-hook:
222         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpme
223         @@LN_S@ rpmi $(DESTDIR)$(rpmlibexecdir)/rpme
224         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpmu
225         @@LN_S@ rpmi $(DESTDIR)$(rpmlibexecdir)/rpmu
226         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpmv
227         @@LN_S@ rpmq $(DESTDIR)$(rpmlibexecdir)/rpmv
228         rm -f $(DESTDIR)$(bindir)/rpmquery
229         @LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
230         rm -f $(DESTDIR)$(bindir)/rpmverify
231         @LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
232         rm -f $(DESTDIR)$(bindir)/rpmsign
233         @LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
234         rm -f $(DESTDIR)$(bindir)/rpmdb ; \
235         @LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
236         for bf in e i u ; do \
237             rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
238             @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
239         done
240
241 install-data-local:
242         @case "@host_os@" in \
243         solaris*|linux*|darwin*) \
244            DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" $(SHELL) $(top_srcdir)/installplatform rpmrc macros platform ;; \
245         esac
246         @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp
247
248 # XXX to appease distcheck we need to remove "stuff" here...
249 uninstall-local:
250         @rm -rf $(DESTDIR)/$(rpmconfigdir)/platform
251         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpmu
252         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpme
253         @rm -f $(DESTDIR)$(rpmlibexecdir)/rpmv
254         @rm -f $(DESTDIR)$(bindir)/rpmquery
255         @rm -f $(DESTDIR)$(bindir)/rpmu
256         @rm -f $(DESTDIR)$(bindir)/rpmsign
257         @rm -f $(DESTDIR)$(bindir)/rpme
258         @rm -f $(DESTDIR)$(bindir)/rpmverify
259         @rm -f $(DESTDIR)$(bindir)/rpmdb
260         @rm -f $(DESTDIR)$(bindir)/rpmi
261
262 MAINTAINERCLEANFILES = ChangeLog
263
264 # Build hacking docs only on request
265 if HACKINGDOCS
266 if DOXYGEN
267 doc/hacking.doxy: doc/hacking.doxy.in doc/hacking/Doxyheader Makefile.am
268         $(SED) \
269           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
270           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
271           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
272           -e "s,[@]VERSION[@],$(VERSION)," \
273         < $(top_srcdir)/doc/hacking.doxy.in > doc/hacking.doxy
274
275 doc/hacking/html/index.html: doc/hacking.doxy rpmpopt-@VERSION@
276         @DOXYGEN@ doc/hacking.doxy
277 noinst_DATA += doc/hacking/html/index.html
278 endif
279 endif
280 EXTRA_DIST += doc/hacking.doxy.in doc/hacking/Doxyheader
281
282 # Always build librpm docs
283 if DOXYGEN
284 doc/librpm.doxy: doc/librpm.doxy.in doc/librpm/Doxyheader Makefile.am $(pkginclude_HEADERS)
285         files=`echo " $(HEADERS)" | $(SED) -e "s, , \@top_srcdir\@/,g"`; \
286         $(SED) -e "s,[@]pkginclude_HEADERS[@],$$files," \
287           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
288           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
289           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
290           -e "s,[@]VERSION[@],$(VERSION)," \
291         < $(top_srcdir)/doc/librpm.doxy.in > doc/librpm.doxy
292
293 doc/librpm/html/index.html: doc/librpm.doxy
294         @DOXYGEN@ doc/librpm.doxy
295 noinst_DATA += doc/librpm/html/index.html
296 endif
297 EXTRA_DIST += doc/librpm.doxy.in doc/librpm/Doxyheader
298 EXTRA_DIST += doc/librpm/html
299
300 if WITH_INTERNAL_DB
301 db.h:   $(top_builddir)/db3/db.h
302         $(LN_S) $(top_builddir)/db3/db.h $@
303 BUILT_SOURCES += db.h
304 endif
305 DISTCLEANFILES += db.h
306
307 clean-local:
308         rm -rf doc/hacking/html
309         rm -rf include
310
311 distclean-local:
312         rm -rf Doxytags
313         rm -f stamp-h.in db3/*.orig db3/db3lobjs
314
315 maintainer-clean-local:
316         rm -rf doc/librpm/html
317
318 $(top_srcdir)/preinstall.am: Makefile.am
319         rm -f $(top_srcdir)/preinstall.am
320         @for f in $(HEADERS); do \
321           b=`basename $$f`; \
322           echo 'include/rpm/'$$b': '$$f' include/rpm/$$(dirstamp)' >> $(top_srcdir)/preinstall.am;\
323           echo '        $$(INSTALL_DATA) $$(top_srcdir)/'$$f' include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
324           echo 'BUILT_SOURCES += include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
325           echo 'CLEANFILES += include/rpm/'$$b  >> $(top_srcdir)/preinstall.am; \
326          done
327
328 include/rpm/$(dirstamp):
329         @$(MKDIR_P) include/rpm
330         @: > include/rpm/$(dirstamp)
331
332 include $(top_srcdir)/preinstall.am