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