rpm/Makefile.in

116 lines
2.9 KiB
Makefile

### These are variables meant to be exported
WARNINGS = -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes
#DEBUG = -g
OPTS = -O2
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.0e
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
.EXPORT_ALL_VARIABLES:
### End exported variables
# -----------------------------------------------------------------------
SUBDIRS = lib build tools
OBJS = query.o install.o verify.o
PROGS = rpm rpmconvert
LOADLIBES = -lbuild -lrpm -ldb /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) -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:
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 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)
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