# This stuff should be reasonably changeable ifndef RPM_OPT_FLAGS RPM_OPT_FLAGS = -O2 endif #DEBUG = -g OPTS = ${RPM_OPT_FLAGS} prefix=$(ROOT)/usr #LIBEFENCE = -lefence ################################### Leave this stuff alone ### These are variables meant to be exported WARNINGS = -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes CFLAGS = $(WARNINGS) $(DEBUG) $(OPTS) -Ilib -Ibuild -I../lib -I../build LDFLAGS = $(DEBUG) -Llib -Lbuild -L../lib -L../build AR = ar r RANLIB = ranlib VERSION = 2.1 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 = rpm.o query.o install.o verify.o checksig.o ftp.o PROGS = rpm rpmconvert rpm2cpio LOADLIBES = -lbuild -lrpm -ldb /usr/lib/libgz.a ifeq (.depend,$(wildcard .depend)) TARGET=everything else TARGET=depend everything endif all: $(TARGET) rpm: lib/librpm.a build/libbuild.a gettextstub.o $(OBJS) $(CC) -o rpm -static $(LDFLAGS) $(OBJS) $(LOADLIBES) -lintl $(LIBEFENCE) $(CC) -o rpm.shared $(LDFLAGS) $(OBJS) gettextstub.o $(LOADLIBES) $(LIBEFENCE) rpm2cpio: lib/librpm.a rpm2cpio.o $(CC) -o rpm2cpio $(LDFLAGS) rpm2cpio.o $(LOADLIBES) -lintl 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) $(LDFLAGS) -o rpmconvert convertdb.o lib/librpm.a -ldb -lgdbm make-subdirs: for d in $(SUBDIRS); do \ (cd $$d; $(MAKE)) \ || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac;\ done && test -z "$$fail" newtree: rm -f RCS ln -sf /usr/rhs/RCS/rpm-2.0 RCS for d in $(SUBDIRS); do \ mkdir -p $$d ;\ (cd $$d; rm -f RCS; ln -sf /usr/rhs/RCS/rpm-2.0/$$d RCS) \ || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac;\ done && test -z "$$fail" $(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 -s -m 755 -o 0 -g 0 rpm2cpio $(BINDIR) install -m 644 -o 0 -g 0 rpm.8 $(MANDIR) install -m 644 -o 0 -g 0 rpm2cpio.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) rpm.shared 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 "rcs -n$(VERSION): RCS/*,v on all of the directories btw." ifeq (.depend,$(wildcard .depend)) include .depend endif