summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 441bec907a8ae9b20cfb01d94b2416dd8dacb47e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# Top level Makefile for rpm

ACLOCAL_AMFLAGS = -I m4

include $(top_srcdir)/rpm.am

CLEANFILES =
EXTRA_DIST = CHANGES ChangeLog CREDITS GROUPS INSTALL \
	autodeps autogen.sh \
	db db3/configure installplatform platform.in
BUILT_SOURCES =

SUBDIRS = po misc
if WITH_INTERNAL_DB
SUBDIRS += db3
endif
SUBDIRS += lua rpmio rpmdb lib build python scripts doc . tests

DIST_SUBDIRS = po misc db3 lua rpmio rpmdb lib build python scripts doc tests

pkgconfigdir = $(libdir)/pkgconfig

AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/include/
AM_CPPFLAGS += -I$(top_srcdir)/build
AM_CPPFLAGS += -I$(top_srcdir)/lib
AM_CPPFLAGS += -I$(top_builddir)/rpmdb -I$(top_srcdir)/rpmdb
AM_CPPFLAGS += -I$(top_srcdir)/rpmio
AM_CPPFLAGS += @WITH_NSS_INCLUDE@
AM_CPPFLAGS += @WITH_POPT_INCLUDE@
AM_CPPFLAGS += -I$(top_srcdir)/misc
AM_CPPFLAGS += @WITH_LIBELF_INCLUDE@
AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\""
AM_CPPFLAGS += -DRPMCONFIGDIR="\"@RPMCONFIGDIR@\""
AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"@RPMCONFIGDIR@/rpmpopt-${VERSION}\""

staticLDFLAGS = @LDFLAGS_STATIC@ @LDFLAGS_NPTL@

pkginclude_HEADERS =
nodist_pkginclude_HEADERS =

pkginclude_HEADERS += rpmio/argv.h
pkginclude_HEADERS += rpmio/rpmio.h
pkginclude_HEADERS += rpmio/rpmurl.h
pkginclude_HEADERS += rpmio/rpmmacro.h
pkginclude_HEADERS += rpmio/rpmlog.h
pkginclude_HEADERS += rpmio/rpmpgp.h
pkginclude_HEADERS += rpmio/rpmsq.h
pkginclude_HEADERS += rpmio/rpmstring.h
pkginclude_HEADERS += rpmio/rpmsw.h
pkginclude_HEADERS += rpmio/rpmfileutil.h

pkginclude_HEADERS += rpmdb/header.h
pkginclude_HEADERS += rpmdb/rpmdb.h
nodist_pkginclude_HEADERS += rpmdb/rpmints.h

pkginclude_HEADERS += lib/idtx.h
pkginclude_HEADERS += lib/rpmcallback.h
pkginclude_HEADERS += lib/rpmcli.h
pkginclude_HEADERS += lib/rpmlib.h
pkginclude_HEADERS += lib/rpmal.h
pkginclude_HEADERS += lib/rpmds.h
pkginclude_HEADERS += lib/rpmfi.h
pkginclude_HEADERS += lib/rpmgi.h
pkginclude_HEADERS += lib/rpmps.h
pkginclude_HEADERS += lib/rpmtag.h
pkginclude_HEADERS += lib/rpmte.h
pkginclude_HEADERS += lib/rpmts.h

pkginclude_HEADERS += build/rpmbuild.h
pkginclude_HEADERS += build/rpmfc.h
pkginclude_HEADERS += build/rpmspec.h


rpmbindir = `echo $(bindir) | $(SED) -e s,usr/bin,bin,`
rpmbin_PROGRAMS = rpm

bin_PROGRAMS =		rpm2cpio

rpmlibexec_PROGRAMS =	rpmb rpmd rpmi rpmk rpmq
rpmconfig_SCRIPTS =	find-provides find-requires mkinstalldirs \
			config.guess config.sub
DISTCLEANFILES = find-provides
DISTCLEANFILES += find-requires

rpm_SOURCES =		rpmqv.c debug.h system.h
rpm_CPPFLAGS =		$(AM_CPPFLAGS) -DIAM_RPMDB -DIAM_RPMEIU -DIAM_RPMK -DIAM_RPMQV
rpm_LDADD =		build/librpmbuild.la lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
rpm_LDADD +=		@WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@

rpmb_SOURCES =		build.c rpmqv.c build.h debug.h system.h
rpmb_CPPFLAGS =		$(AM_CPPFLAGS) -DIAM_RPMBT
rpmb_LDADD =		build/librpmbuild.la lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
rpmb_LDADD += 		@WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@

rpmd_SOURCES =		rpmqv.c debug.h system.h
rpmd_CPPFLAGS =		$(AM_CPPFLAGS) -DIAM_RPMDB
rpmd_LDADD =		lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
rpmd_LDADD +=		@WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@

rpmi_SOURCES =		rpmqv.c debug.h system.h
rpmi_CPPFLAGS =		$(AM_CPPFLAGS) -DIAM_RPMEIU
rpmi_LDADD =		lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
rpmi_LDADD +=		@WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@

rpmk_SOURCES =		rpmqv.c debug.h system.h
rpmk_CPPFLAGS =		$(AM_CPPFLAGS) -DIAM_RPMK
rpmk_LDADD =		lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
rpmk_LDADD +=		@WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@

rpmq_SOURCES =		rpmqv.c debug.h system.h
rpmq_CPPFLAGS =		$(AM_CPPFLAGS) -DIAM_RPMQV
rpmq_LDADD =		build/librpmbuild.la lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
rpmq_LDADD +=		@WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@

rpm2cpio_SOURCES =	rpm2cpio.c debug.h system.h
rpm2cpio_LDADD =	lib/librpm.la rpmdb/librpmdb.la rpmio/librpmio.la
rpm2cpio_LDADD +=	@WITH_LIBELF_LIB@ @WITH_NSS_LIB@ @WITH_POPT_LIB@ @WITH_ZLIB_LIB@


if LIBELF
if LIBDWARF
rpmconfig_SCRIPTS += scripts/find-debuginfo.sh

rpmlibexec_PROGRAMS +=	debugedit
debugedit_SOURCES =	tools/debugedit.c tools/hashtab.c tools/hashtab.h
debugedit_LDADD =	rpmio/librpmio.la
debugedit_LDADD +=	@WITH_LIBELF_LIB@ @WITH_POPT_LIB@
endif
endif

rpmlibexec_PROGRAMS +=	javadeps
javadeps_SOURCES =	tools/javadeps.c
javadeps_LDADD =

rpmlibexec_PROGRAMS +=	rpmcache
rpmcache_SOURCES =	tools/rpmcache.c
rpmcache_LDADD =	lib/librpm.la

rpmlibexec_PROGRAMS +=	rpmdeps
rpmdeps_SOURCES =	tools/rpmdeps.c
rpmdeps_LDADD =		build/librpmbuild.la

bin_PROGRAMS +=		rpmgraph
rpmgraph_SOURCES =	tools/rpmgraph.c
rpmgraph_LDADD =	lib/librpm.la

dist_bin_SCRIPTS =	scripts/gendiff

check_PROGRAMS = 	dumpdb
dumpdb_SOURCES = 	tools/dumpdb.c
dumpdb_LDADD =		lib/librpm.la

check_PROGRAMS +=	convertdb1
convertdb1_SOURCES =	tools/convertdb1.c
convertdb1_LDADD =	lib/librpm.la

check_PROGRAMS +=	rpminject
rpminject_SOURCES =	tools/rpminject.c
rpminject_LDADD =	build/librpmbuild.la

check_PROGRAMS +=	rpmsort
rpmsort_SOURCES =	tools/rpmsort.c
rpmsort_LDADD =		lib/librpm.la

rpmconfig_DATA = rpmrc
rpmrc: $(top_srcdir)/rpmrc.in
	@$(SED) \
	  -e "s,[@]SYSCONFIGDIR[@],$(sysconfdir)/rpm,g" \
	  < $(top_srcdir)/rpmrc.in > rpmrc.tmp \
	  && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmrc:${subdir}/rpmrc.tmp )
CLEANFILES += rpmrc.tmp rpmrc
EXTRA_DIST += rpmrc.in

rpmconfig_DATA += macros
macros: $(top_srcdir)/macros.in
	@$(SED) \
	  -e "s,[@]varprefix[@],$(localstatedir),g" \
	  < $(top_srcdir)/macros.in > macros.tmp \
	  && ( cd $(top_builddir) && ./config.status --file=${subdir}/macros:${subdir}/macros.tmp )
CLEANFILES += macros.tmp macros
EXTRA_DIST += macros.in

noinst_DATA = platform
platform: $(top_srcdir)/platform.in
	@$(SED) \
	  -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
	  < $(top_srcdir)/platform.in > platform.tmp \
	  && ( cd $(top_builddir) && ./config.status --file=${subdir}/platform:${subdir}/platform.tmp )
CLEANFILES += platform.tmp platform
EXTRA_DIST += platform.in

pkgconfig_DATA = rpm.pc
rpm.pc: $(top_srcdir)/rpm.pc.in
	@$(SED) \
	  -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
	  < $(top_srcdir)/rpm.pc.in > rpm.pc.tmp \
	  && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpm.pc:${subdir}/rpm.pc.tmp )
CLEANFILES += rpm.pc.tmp rpm.pc
EXTRA_DIST += rpm.pc.in

rpmconfig_DATA += rpmpopt-$(VERSION)
rpmpopt-@VERSION@: $(top_srcdir)/rpmpopt.in
	@$(SED) \
	  -e "s,[@]RPMCONFIGDIR[@],$(rpmconfigdir),g" \
	  < $(top_srcdir)/rpmpopt.in > rpmpopt-@VERSION@.tmp \
	  && ( cd $(top_builddir) && ./config.status --file=${subdir}/rpmpopt-@VERSION@:${subdir}/rpmpopt-@VERSION@.tmp )
CLEANFILES += rpmpopt-@VERSION@.tmp rpmpopt-@VERSION@
EXTRA_DIST += rpmpopt.in

usrsrcdir = $(prefix)/src

pkgsrcdir = $(usrsrcdir)/packages
pkgsrc_RPMSdir = $(pkgsrcdir)/RPMS
pkgsrc_RPMS_DATA =
pkgsrc_SRPMSdir = $(pkgsrcdir)/SRPMS
pkgsrc_SRPMS_DATA =
pkgsrc_SPECSdir = $(pkgsrcdir)/SPECS
pkgsrc_SPECS_DATA =
pkgsrc_SOURCESdir = $(pkgsrcdir)/SOURCES
pkgsrc_SOURCES_DATA =
pkgsrc_BUILDdir = $(pkgsrcdir)/BUILD
pkgsrc_BUILD_DATA =

rpmvardir = $(localstatedir)/lib/rpm
rpmvar_DATA =

install-exec-hook:
	@rm -f $(DESTDIR)$(rpmlibexecdir)/rpmt
	@@LN_S@ rpmb $(DESTDIR)$(rpmlibexecdir)/rpmt
	@rm -f $(DESTDIR)$(rpmlibexecdir)/rpme
	@@LN_S@ rpmi $(DESTDIR)$(rpmlibexecdir)/rpme
	@rm -f $(DESTDIR)$(rpmlibexecdir)/rpmu
	@@LN_S@ rpmi $(DESTDIR)$(rpmlibexecdir)/rpmu
	@rm -f $(DESTDIR)$(rpmlibexecdir)/rpmv
	@@LN_S@ rpmq $(DESTDIR)$(rpmlibexecdir)/rpmv
	rm -f $(DESTDIR)$(bindir)/rpmbuild
	@LN_S@ ../lib/rpm/rpmb $(DESTDIR)$(bindir)/rpmbuild
	rm -f $(DESTDIR)$(bindir)/rpmquery
	@LN_S@ ../lib/rpm/rpmq $(DESTDIR)$(bindir)/rpmquery
	rm -f $(DESTDIR)$(bindir)/rpmverify
	@LN_S@ ../lib/rpm/rpmv $(DESTDIR)$(bindir)/rpmverify
	rm -f $(DESTDIR)$(bindir)/rpmsign
	@LN_S@ ../lib/rpm/rpmk $(DESTDIR)$(bindir)/rpmsign
	rm -f $(DESTDIR)$(bindir)/rpmdb ; \
	@LN_S@ ../lib/rpm/rpmd $(DESTDIR)$(bindir)/rpmdb ; \
	for bf in e i u ; do \
	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
	done

install-data-local:
	@case "@host_cpu@" in \
	*86)	$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i386 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i486 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i586 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/i686 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/athlon ;;\
	alpha*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/alpha ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/alphaev6 ;;\
	arm*)	$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv3l ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4l ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv4tl ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tel ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv5tejl ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/armv6l ;;\
	sparc*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv8 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv9 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv9v ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc64 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc64v ;;\
	ia64*)	$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ia64 ;;\
	s390*)	$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/s390 ;;\
	mipsel*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/mipsel ;;\
	mips*)  $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/mips ;;\
	powerpc*) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppciseries ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppcpseries ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc64 ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc64iseries ;\
		$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc64pseries ;;\
	*)	$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/@host_cpu@ ;;\
	esac
	$(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
	@case "@host_os@" in \
	mint) $(MKDIR_P) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
	solaris*|linux*|darwin*) \
	   DESTDIR="$(DESTDIR)" pkglibdir="$(rpmconfigdir)" $(SHELL) $(top_srcdir)/installplatform rpmrc macros platform ;; \
	esac
	@$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp

# XXX to appease distcheck we need to remove "stuff" here...
uninstall-local:
	@rm -rf $(DESTDIR)/$(rpmconfigdir)/*-*
	rm -f $(DESTDIR)$(rpmlibexecdir)/rpmu
	rm -f $(DESTDIR)$(rpmlibexecdir)/rpme
	rm -f $(DESTDIR)$(rpmlibexecdir)/rpmt
	rm -f $(DESTDIR)$(rpmlibexecdir)/rpmv
	rm -f $(DESTDIR)$(bindir)/rpmquery
	rm -f $(DESTDIR)$(bindir)/rpmbuild
	rm -f $(DESTDIR)$(bindir)/rpmu
	rm -f $(DESTDIR)$(bindir)/rpmsign
	rm -f $(DESTDIR)$(bindir)/rpme
	rm -f $(DESTDIR)$(bindir)/rpmverify
	rm -f $(DESTDIR)$(bindir)/rpmdb
	rm -f $(DESTDIR)$(bindir)/rpmi

MAINTAINERCLEANFILES = ChangeLog

.PHONY:	setperms
setperms:
	@for f in $(rpmbin_PROGRAMS) ; do\
	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(rpmbindir)/$$f ;\
	    $(__CHMOD) g+s $(DESTDIR)$(rpmbindir)/$$f ;\
	done
	@for f in $(bin_PROGRAMS) ; do\
	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(bindir)/$$f ;\
	done
	@for f in $(rpmlibexec_PROGRAMS) ; do\
	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(rpmlibexecdir)/$$f ;\
	    $(__CHMOD) g+s $(DESTDIR)$(rpmlibexecdir)/$$f ;\
	done
	@for f in $(pkglib_SCRIPTS) ; do\
	    $(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)/$$f ;\
	done
	@$(__CHOWN) ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(pkglibdir)
	@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(rpmvardir)
	-@$(__CHMOD) 0664 $(DESTDIR)$(rpmvardir)/[A-Z]*
	-@$(__CHMOD) 0775 $(DESTDIR)$(rpmvardir)
	-@$(__CHMOD) 0664 $(DESTDIR)$(rpmvardir)/__db.*

.PHONY:	unsetgid
unsetgid:
	@for f in $(rpmbin_PROGRAMS) ; do\
	    $(__CHMOD) g-s $(DESTDIR)$(rpmbindir)/$$f ;\
	done
	@for f in $(rpmlibexec_PROGRAMS) ; do\
	    $(__CHMOD) g-s $(DESTDIR)$(rpmlibexecdir)/$$f ;\
	done

# Build hacking docs only on request
if HACKINGDOCS
if DOXYGEN
doc/hacking.doxy: doc/hacking.doxy.in doc/hacking/Doxyheader Makefile.am
	$(SED) \
	  -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
	  -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
	  -e "s,[@]PACKAGE[@],$(PACKAGE)," \
	  -e "s,[@]VERSION[@],$(VERSION)," \
	< $(top_srcdir)/doc/hacking.doxy.in > doc/hacking.doxy

doc/hacking/html/index.html: doc/hacking.doxy rpmpopt-@VERSION@
	@DOXYGEN@ doc/hacking.doxy
noinst_DATA += doc/hacking/html/index.html
endif
endif
EXTRA_DIST += doc/hacking.doxy.in doc/hacking/Doxyheader

# Always build librpm docs
if DOXYGEN
doc/librpm.doxy: doc/librpm.doxy.in doc/librpm/Doxyheader Makefile.am $(pkginclude_HEADERS)
	files=`echo " $(HEADERS)" | $(SED) -e "s, , \@top_srcdir\@/,g"`; \
	$(SED) -e "s,[@]pkginclude_HEADERS[@],$$files," \
	  -e "s,\@top_srcdir\@/,$(top_srcdir)/,g" \
	  -e "s,[@]HAVE_DOT[@],$(HAVE_DOT)," \
	  -e "s,[@]PACKAGE[@],$(PACKAGE)," \
	  -e "s,[@]VERSION[@],$(VERSION)," \
	< $(top_srcdir)/doc/librpm.doxy.in > doc/librpm.doxy

doc/librpm/html/index.html: doc/librpm.doxy
	@DOXYGEN@ doc/librpm.doxy
noinst_DATA += doc/librpm/html/index.html
endif
EXTRA_DIST += doc/librpm.doxy.in doc/librpm/Doxyheader
EXTRA_DIST += doc/librpm/html

if WITH_INTERNAL_DB
db.h:	$(top_builddir)/db3/db.h
	$(LN_S) $(top_builddir)/db3/db.h $@
BUILT_SOURCES += db.h
endif
DISTCLEANFILES += db.h

clean-local:
	rm -rf doc/hacking/html
	rm -rf include

distclean-local:
	rm -rf Doxytags
	rm -f stamp-h.in db3/*.orig db3/db3lobjs

maintainer-clean-local:
	rm -rf doc/librpm/html

$(top_srcdir)/preinstall.am: Makefile.am
	rm -f $(top_srcdir)/preinstall.am
	@for f in $(HEADERS); do \
	  b=`basename $$f`; \
	  echo 'include/rpm/'$$b': '$$f' include/rpm/$$(dirstamp)' >> $(top_srcdir)/preinstall.am;\
	  echo '	$$(INSTALL_DATA) $$(top_srcdir)/'$$f' include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
	  echo 'BUILT_SOURCES += include/rpm/'$$b >> $(top_srcdir)/preinstall.am; \
	  echo 'CLEANFILES += include/rpm/'$$b  >> $(top_srcdir)/preinstall.am; \
	 done

include/rpm/$(dirstamp):
	@$(MKDIR_P) include/rpm
	@: > include/rpm/$(dirstamp)

include $(top_srcdir)/preinstall.am