Eliminate rpmd, rpmi, rpmk, rpmq "helper binaries"
[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 =
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 rpm2cpio_SOURCES =      rpm2cpio.c debug.h system.h
102 rpm2cpio_LDADD =        lib/librpm.la rpmio/librpmio.la
103 rpm2cpio_LDADD +=       @WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@
104
105
106 if LIBELF
107 if LIBDWARF
108 rpmconfig_SCRIPTS += scripts/find-debuginfo.sh
109
110 rpmlibexec_PROGRAMS +=  debugedit
111 debugedit_SOURCES =     tools/debugedit.c tools/hashtab.c tools/hashtab.h
112 debugedit_LDADD =       rpmio/librpmio.la
113 debugedit_LDADD +=      @WITH_LIBELF_LIB@ @WITH_POPT_LIB@
114 endif
115 endif
116
117 rpmlibexec_PROGRAMS +=  javadeps
118 javadeps_SOURCES =      tools/javadeps.c
119 javadeps_LDADD =
120
121 rpmlibexec_PROGRAMS +=  rpmcache
122 rpmcache_SOURCES =      tools/rpmcache.c
123 rpmcache_LDADD =        lib/librpm.la
124
125 rpmlibexec_PROGRAMS +=  rpmdeps
126 rpmdeps_SOURCES =       tools/rpmdeps.c
127 rpmdeps_LDADD =         build/librpmbuild.la
128
129 bin_PROGRAMS +=         rpmgraph
130 rpmgraph_SOURCES =      tools/rpmgraph.c
131 rpmgraph_LDADD =        lib/librpm.la
132
133 dist_bin_SCRIPTS =      scripts/gendiff
134
135 check_PROGRAMS =        dumpdb
136 dumpdb_SOURCES =        tools/dumpdb.c
137 dumpdb_LDADD =          lib/librpm.la
138
139 check_PROGRAMS +=       convertdb1
140 convertdb1_SOURCES =    tools/convertdb1.c
141 convertdb1_LDADD =      lib/librpm.la
142
143 check_PROGRAMS +=       rpminject
144 rpminject_SOURCES =     tools/rpminject.c
145 rpminject_LDADD =       build/librpmbuild.la
146
147 check_PROGRAMS +=       rpmsort
148 rpmsort_SOURCES =       tools/rpmsort.c
149 rpmsort_LDADD =         lib/librpm.la
150
151 rpmconfig_DATA = rpmrc
152 rpmrc: $(top_srcdir)/rpmrc.in
153         @$(SED) \
154           -e "s,[@]SYSCONFIGDIR[@],$(sysconfdir)/rpm,g" \
155           < $(top_srcdir)/rpmrc.in > rpmrc.tmp \
156           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmrc:${subdir}/rpmrc.tmp )
157 CLEANFILES += rpmrc.tmp rpmrc
158 EXTRA_DIST += rpmrc.in
159
160 rpmconfig_DATA += macros
161 macros: $(top_srcdir)/macros.in
162         @$(SED) \
163           -e "s,[@]varprefix[@],$(localstatedir),g" \
164           < $(top_srcdir)/macros.in > macros.tmp \
165           && ( cd $(top_builddir) && ./config.status --file=${subdir}/macros:${subdir}/macros.tmp )
166 CLEANFILES += macros.tmp macros
167 EXTRA_DIST += macros.in
168
169 noinst_DATA = platform
170 platform: $(top_srcdir)/platform.in
171         @$(SED) \
172           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
173           < $(top_srcdir)/platform.in > platform.tmp \
174           && ( cd $(top_builddir) && ./config.status --file=${subdir}/platform:${subdir}/platform.tmp )
175 CLEANFILES += platform.tmp platform
176 EXTRA_DIST += platform.in
177
178 pkgconfig_DATA = rpm.pc
179 rpm.pc: $(top_srcdir)/rpm.pc.in
180         @$(SED) \
181           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
182           < $(top_srcdir)/rpm.pc.in > rpm.pc.tmp \
183           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpm.pc:${subdir}/rpm.pc.tmp )
184 CLEANFILES += rpm.pc.tmp rpm.pc
185 EXTRA_DIST += rpm.pc.in
186
187 rpmconfig_DATA += rpmpopt-$(VERSION)
188 rpmpopt-@VERSION@: $(top_srcdir)/rpmpopt.in
189         @$(SED) \
190           -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
191           < $(top_srcdir)/rpmpopt.in > rpmpopt-@VERSION@.tmp \
192           && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmpopt-@VERSION@:${subdir}/rpmpopt-@VERSION@.tmp )
193 CLEANFILES += rpmpopt-@VERSION@.tmp rpmpopt-@VERSION@
194 EXTRA_DIST += rpmpopt.in
195
196 usrsrcdir = $(prefix)/src
197
198 rpmvardir = $(localstatedir)/lib/rpm
199 rpmvar_DATA =
200
201 install-exec-hook:
202         rm -f $(DESTDIR)$(bindir)/rpmquery
203         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmquery
204         rm -f $(DESTDIR)$(bindir)/rpmverify
205         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmverify
206         rm -f $(DESTDIR)$(bindir)/rpmsign
207         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmsign
208         rm -f $(DESTDIR)$(bindir)/rpmdb
209         @LN_S@ ../../bin/rpm $(DESTDIR)$(bindir)/rpmdb
210
211 install-data-local:
212         @case "@host_os@" in \
213         solaris*|linux*|darwin*) \
214            DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" $(SHELL) $(top_srcdir)/installplatform rpmrc macros platform ;; \
215         esac
216         @$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp
217
218 # XXX to appease distcheck we need to remove "stuff" here...
219 uninstall-local:
220         @rm -f $(DESTDIR)$(bindir)/rpmquery
221         @rm -f $(DESTDIR)$(bindir)/rpmsign
222         @rm -f $(DESTDIR)$(bindir)/rpmverify
223         @rm -f $(DESTDIR)$(bindir)/rpmdb
224
225 MAINTAINERCLEANFILES = ChangeLog
226
227 # Build hacking docs only on request
228 if HACKINGDOCS
229 if DOXYGEN
230 doc/hacking.doxy: doc/hacking.doxy.in doc/hacking/Doxyheader Makefile.am
231         $(SED) \
232           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
233           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
234           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
235           -e "s,[@]VERSION[@],$(VERSION)," \
236         < $(top_srcdir)/doc/hacking.doxy.in > doc/hacking.doxy
237
238 doc/hacking/html/index.html: doc/hacking.doxy rpmpopt-@VERSION@
239         @DOXYGEN@ doc/hacking.doxy
240 noinst_DATA += doc/hacking/html/index.html
241 endif
242 endif
243 EXTRA_DIST += doc/hacking.doxy.in doc/hacking/Doxyheader
244
245 # Always build librpm docs
246 if DOXYGEN
247 doc/librpm.doxy: doc/librpm.doxy.in doc/librpm/Doxyheader Makefile.am $(pkginclude_HEADERS)
248         files=`echo " $(HEADERS)" | $(SED) -e "s, , \@top_srcdir\@/,g"`; \
249         $(SED) -e "s,[@]pkginclude_HEADERS[@],$$files," \
250           -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
251           -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
252           -e "s,[@]PACKAGE[@],$(PACKAGE)," \
253           -e "s,[@]VERSION[@],$(VERSION)," \
254         < $(top_srcdir)/doc/librpm.doxy.in > doc/librpm.doxy
255
256 doc/librpm/html/index.html: doc/librpm.doxy
257         @DOXYGEN@ doc/librpm.doxy
258 noinst_DATA += doc/librpm/html/index.html
259 endif
260 EXTRA_DIST += doc/librpm.doxy.in doc/librpm/Doxyheader
261 EXTRA_DIST += doc/librpm/html
262
263 if WITH_INTERNAL_DB
264 db.h:   $(top_builddir)/db3/db.h
265         $(LN_S) $(top_builddir)/db3/db.h $@
266 BUILT_SOURCES += db.h
267 endif
268 DISTCLEANFILES += db.h
269
270 clean-local:
271         rm -rf doc/hacking/html
272         rm -rf include
273
274 distclean-local:
275         rm -rf Doxytags
276         rm -f stamp-h.in db3/*.orig db3/db3lobjs
277
278 maintainer-clean-local:
279         rm -rf doc/librpm/html
280
281 $(top_srcdir)/preinstall.am: Makefile.am
282         rm -f $(top_srcdir)/preinstall.am
283         @for f in $(HEADERS); do \
284           b=`basename $$f`; \
285           echo 'include/rpm/'$$b': '$$f' include/rpm/$$(dirstamp)' >> $(top_srcdir)/preinstall.am;\
286           echo '        $$(INSTALL_DATA) $$(top_srcdir)/'$$f' include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
287           echo 'BUILT_SOURCES += include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
288           echo 'CLEANFILES += include/rpm/'$$b  >> $(top_srcdir)/preinstall.am; \
289          done
290
291 include/rpm/$(dirstamp):
292         @$(MKDIR_P) include/rpm
293         @: > include/rpm/$(dirstamp)
294
295 include $(top_srcdir)/preinstall.am