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