summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: aad7604a8d1bbeae78cb0b598f1c6383aab72f63 (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
# Top level Makefile for rpm

AUTOMAKE_OPTIONS = 1.4 foreign

EXTRA_DIST = CHANGES CREDITS Doxyheader GROUPS README.amiga INSTALL \
	RPM-GPG-KEY RPM-PGP-KEY \
	autodeps/none autodeps/*.prov autodeps/*.req autogen.sh \
	gendiff installplatform platform* \
	po/*.in po/*.po po/rpm.pot \
	rpm.magic rpmpopt-$(VERSION) rpmqv.c

# XXX TODO: perl
SUBDIRS = intl po popt rpmio lib build misc @WITH_PYTHON_SUBDIR@ tools scripts tests doc .

INCLUDES = -I$(top_srcdir)/build -I$(top_srcdir)/lib -I$(top_srcdir)/rpmio \
	-I$(top_srcdir)/popt @INCPATH@

LIBS =

myLDFLAGS = # -L$(top_builddir)/build/.libs -L$(top_builddir)/lib/.libs \
	-L$(top_builddir)/rpmio/.libs -L$(top_builddir)/popt/.libs

# XXX libtool can/should generate dependent libs.
# XXX solaris2.6 cannot use *.la with --all-static (downrev binutils/egcs?)
# XXX top_builddir ldpaths are wrong building in tree
myLDADD = $(top_builddir)/build/librpmbuild.la $(top_builddir)/lib/librpm.la \
	$(top_builddir)/rpmio/librpmio.la $(top_builddir)/popt/libpopt.la \
	@INTLLIBS@ @LIBMISC@

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

bin_PROGRAMS =		rpm2cpio
bin_SCRIPTS =		gendiff

pkglibdir =		@RPMCONFIGDIR@
pkglib_PROGRAMS =	rpmb rpmdb rpmi rpmk rpmq
pkglib_DATA =		rpmrc rpmpopt-$(VERSION) macros
pkglib_SCRIPTS =	find-provides find-requires mkinstalldirs \
			config.guess config.sub

rpmpopt-$(VERSION): rpmpopt
	cp rpmpopt $@

noinst_HEADERS = \
	acconfig.h	build.h		debug.h		system.h

rpm_SOURCES =		rpm.c
rpm_LDFLAGS =		@LDFLAGS_STATIC@ $(myLDFLAGS)
rpm_LDADD =		$(myLDADD)

rpmb_SOURCES =		build.c
rpmb_LDFLAGS =		$(myLDFLAGS)
rpmb_LDADD =		rpmb.o $(myLDADD)
rpmb.o:	rpmqv.c
	$(COMPILE) -DIAM_RPMBT -o $@ -c rpmqv.c

rpmdb_SOURCES =
rpmdb_LDFLAGS =		$(myLDFLAGS)
rpmdb_LDADD =		rpmdb.o $(myLDADD)
rpmdb.o:	rpmqv.c
	$(COMPILE) -DIAM_RPMDB -o $@ -c rpmqv.c

rpmi_SOURCES =
rpmi_LDFLAGS =		$(myLDFLAGS)
rpmi_LDADD =		rpmi.o $(myLDADD)
rpmi.o:	rpmqv.c
	$(COMPILE) -DIAM_RPMEIU -o $@ -c rpmqv.c

rpmk_SOURCES =
rpmk_LDFLAGS =		$(myLDFLAGS)
rpmk_LDADD =		rpmk.o $(myLDADD)
rpmk.o:	rpmqv.c
	$(COMPILE) -DIAM_RPMK -o $@ -c rpmqv.c

rpmq_SOURCES =
rpmq_LDFLAGS =		$(myLDFLAGS)
rpmq_LDADD =		rpmq.o $(myLDADD)
rpmq.o:	rpmqv.c
	$(COMPILE) -DIAM_RPMQV -o $@ -c rpmqv.c

rpm2cpio_SOURCES =	rpm2cpio.c
rpm2cpio_LDFLAGS =	$(myLDFLAGS)
rpm2cpio_LDADD =	$(myLDADD)

$(PROGRAMS): 		$(myLDADD) @WITH_APIDOCS_TARGET@

.PHONY:	lclint
lclint:
	lclint $(DEFS) $(INCLUDES) $(rpm_SOURCES) $(rpmb_SOURCES) rpmqv.c

CVSTAG = r$(subst .,-,$(VERSION))

pkgsrcdir = $(prefix)/src/$(RPMCANONVENDOR)

install-data-local:
	@$(mkinstalldirs) $(DESTDIR)$(varprefix)/lib/rpm
	@rm -f $(DESTDIR)$(libdir)/rpmrc
	@@LN_S@ rpm/rpmrc $(DESTDIR)$(libdir)/rpmrc
	@rm -f $(DESTDIR)$(libdir)/rpmpopt
	@@LN_S@ rpm/rpmpopt $(DESTDIR)$(libdir)/rpmpopt
	@rm -f $(DESTDIR)$(libdir)/rpm/rpmt
	@@LN_S@ rpmb $(DESTDIR)$(libdir)/rpm/rpmt
	@rm -f $(DESTDIR)$(libdir)/rpm/rpme
	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpme
	@rm -f $(DESTDIR)$(libdir)/rpm/rpmu
	@@LN_S@ rpmi $(DESTDIR)$(libdir)/rpm/rpmu
	@rm -f $(DESTDIR)$(libdir)/rpm/rpmv
	@@LN_S@ rpmq $(DESTDIR)$(libdir)/rpm/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
	for bf in db e i u ; do \
	    rm -f $(DESTDIR)$(bindir)/rpm$$bf ; \
	    @LN_S@ ../lib/rpm/rpm$$bf $(DESTDIR)$(bindir)/rpm$$bf ; \
	done
	@$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/BUILD
	@case "@build_cpu@" in \
	*86)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/i386;\
		$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/i486;\
		$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/i586;\
		$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/i686;\
		$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/athlon ;;\
	alpha*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/alpha;\
		$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/alphaev6 ;;\
	sparc*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc;\
		$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparcv9;\
		$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/sparc64 ;;\
	ia64*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/ia64 ;;\
	s390*)	$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/s390 ;;\
	powerpc*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/ppc ;;\
	esac
	@case "@build_os@" in \
	mint) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/m68kmint ;;\
	solaris*|linux*) \
	   chmod u+x ./installplatform; DESTDIR="$(DESTDIR)" pkglibdir="$(pkglibdir)" ./installplatform rpmrc macros platform ; \
	   $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@build_cpu@ ;;\
	*) $(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/@build_cpu@ ;;\
	esac
	@$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/RPMS/noarch
	@$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/SOURCES
	@$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/SPECS
	@$(mkinstalldirs) $(DESTDIR)$(pkgsrcdir)/SRPMS
	@$(mkinstalldirs) $(DESTDIR)/var/tmp

.PHONY: tar
tar:
	rm -rf /tmp/rpm-$(VERSION)
	$(MAKE) DESTDIR=/tmp/rpm-$(VERSION) install
	cd /tmp/rpm-$(VERSION) ; tar cvf /tmp/rpm-$(VERSION).tar .

.PHONY: noconfig
noconfig:
	find . -name "Makefile" -exec rm {} \; 
	rm -f *gz *rpm config.*

.PHONY: archive
archive: 
	@cvs -d `cat CVS/Root` diff 2>&1 > /dev/null || { \
	    echo " " ; \
	    echo "==> Please resolve differences between the repository and" ; \
	    echo "==> your rpm check out before tagging." ; \
	    echo " " ; \
	    cvs -n up ; \
	    echo " " ; \
	    exit 1 ; \
	}
	@cvs -d `cat CVS/Root` -Q tag -F $(CVSTAG) .
	@make dist
	@echo " "
	@echo "The final archive is ./rpm-$(VERSION).tar.gz."

.PHONY:	nextsrpm
nextsrpm: all archive
	@sudo ./rpm -ta rpm-$(VERSION).tar.gz

.PHONY:	doxygen
doxygen @WITH_APIDOCS_TARGET@: Doxyfile
	rm -rf $@
	mkdir -p $@
	- [ X"@__DOXYGEN@" != Xno ] && @__DOXYGEN@

ctags:
	find . -type f -name "*.[ch]*" | xargs @CTAGS@

cscope:
	@CSCOPE@ -b -R

cref: ctags cscope