summaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 3037817cda307cdc0a9bf7c9be60f372c6186c85 (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
### These are variables meant to be exported

WARNINGS = -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes 
#DEBUG = -g
OPTS = 
CFLAGS = $(WARNINGS) $(DEBUG) $(OPTS) -Ilib -Ibuild -I../lib -I../build
LDFLAGS = $(DEBUG) -Llib -Lbuild -L../lib -L../build
#LIBEFENCE = -lefence
AR = ar r
RANLIB = ranlib

VERSION=2.0.4

prefix=$(ROOT)/usr

BINDIR=$(prefix)/bin
RPMBINDIR=$(subst usr/bin,bin,$(BINDIR))
MANDIR=$(prefix)/man/man8
LIBDIR=$(prefix)/lib
INCDIR=$(prefix)/include/rpm
ETCDIR=$(ROOT)/etc
PGPDIR=$(LIBDIR)/rpm
NLSDIR=$(prefix)/lib/locale
NLSPACKAGE=rpm

.EXPORT_ALL_VARIABLES:

### End exported variables
# -----------------------------------------------------------------------

SUBDIRS = lib build tools po
OBJS = query.o install.o verify.o checksig.o ftp.o
PROGS = rpm rpmconvert rpm2cpio
LOADLIBES = -lbuild -lrpm -ldb -lintl /usr/lib/libgz.a $(LIBEFENCE)

ifeq (.depend,$(wildcard .depend))
TARGET=everything
else
TARGET=depend everything
endif

all: $(TARGET)

rpm: lib/librpm.a build/libbuild.a rpm.o
	$(CC) -o rpm -static $(LDFLAGS) rpm.o $(OBJS) $(LOADLIBES)
	$(CC) -o rpm.shared $(LDFLAGS) rpm.o $(OBJS) $(LOADLIBES)

rpm.o: rpm.c query.h install.h lib/rpmlib.h Makefile
	$(CC) $(CFLAGS) -DNLSPACKAGE=\"$(NLSPACKAGE)\" -DNLSDIR=\"$(NLSDIR)\" -DVERSION=\"$(VERSION)\" -c rpm.c

everything: make-subdirs $(PROGS)

rpmconvert: lib/librpm.a convertdb.o
	gcc $(DEBUG) -o rpmconvert convertdb.o lib/librpm.a -ldb -lgdbm 
	
make-subdirs:
	for d in $(SUBDIRS); do \
		(cd $$d; $(MAKE)) ;\
	done

$(PROGS): $(OBJS)

install: all
	install -m 755 -o 0 -g 0 -d $(RPMBINDIR)
	install -m 755 -o 0 -g 0 -d $(BINDIR)
	install -m 755 -o 0 -g 0 -d $(MANDIR)
	install -m 755 -o 0 -g 0 -d $(ETCDIR)
	install -s -m 755 -o 0 -g 0 rpm $(RPMBINDIR)
	install -s -m 755 -o 0 -g 0 rpmconvert $(BINDIR)
	install -m 755 -o 0 -g 0 gendiff $(BINDIR)
	install -m 755 -o 0 -g 0 rpm2cpio $(BINDIR)
	install -m 644 -o 0 -g 0 rpm.8 $(MANDIR)
	if [ ! -f $(ETCDIR)/rpmrc ]; then \
		install -m 644 -o 0 -g 0 rpmrc $(ETCDIR)/rpmrc; \
	fi
	(cd lib; make LIBDIR=$(LIBDIR) INCDIR=$(INCDIR) install)
	(cd po; make LIBDIR=$(LIBDIR) INCDIR=$(INCDIR) install)
	#install -m 755 -o 0 -g 0 -d $(PGPDIR)
	#install -m 600 pubring.pgp $(PGPDIR)
	#install -m 444 RPM-PGP-KEY $(PGPDIR)
	#touch $(PGPDIR)/config.txt

clean:
	for d in $(SUBDIRS); do \
		(cd $$d; $(MAKE) $@) ;\
	done
	rm -f *.a *.o core *~ $(PROGS)

depend:
	$(CPP) $(CFLAGS) -M *.c > .depend
	for d in $(SUBDIRS); do \
		(cd $$d; $(MAKE) $@) ;\
	done

co:
	co RCS/*,v
	for d in $(SUBDIRS); do \
		(cd $$d; co RCS/*,v) ;\
	done

archive: 
	@echo " "
	@echo "I hope you checked everything out and made sure it builds"
	@echo "maybe someday Erik will get around to making that automatic."
	@sleep 5
	@rm -rf /tmp/rpm-$(VERSION)
	@mkdir /tmp/rpm-$(VERSION)
	@tar cSpf - * | (cd /tmp/rpm-$(VERSION); tar xSpf -)
	@cd /tmp/rpm-$(VERSION); \
	    make clean; \
	    find . -name "RCS" -exec rm {} \;  ; \
	    find . -name ".depend" -exec rm {} \;  ; \
	    rm -f *gz *rpm
	@cd /tmp; tar czSpf rpm-$(VERSION).tar.gz rpm-$(VERSION)
	@rm -rf /tmp/rpm-$(VERSION)
	@cp /tmp/rpm-$(VERSION).tar.gz .
	@rm -f /tmp/rpm-$(VERSION).tar.gz 
	@echo " "
	@echo "The final archive is ./rpm-$(VERSION).tar.gz. You should run"
	@echo "-n$(VERSION) RCS/*,v on all of the directories btw."

ifeq (.depend,$(wildcard .depend))
include .depend
endif