summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGavin Romig-Koch <gavin@localhost.localdomain>2009-08-17 15:42:23 -0400
committerGavin Romig-Koch <gavin@localhost.localdomain>2009-08-17 15:42:23 -0400
commit0ddc5ca8ab7ad7b6534077760f81605eb0df7f5f (patch)
tree7345bc871db67df13c203b11bd9c9329dbf0b92a /Makefile
parent8227e1d9b3bd26902f4cc643adf301d36d29ba6b (diff)
downloadfastback-0ddc5ca8ab7ad7b6534077760f81605eb0df7f5f.tar.gz
fastback-0ddc5ca8ab7ad7b6534077760f81605eb0df7f5f.tar.xz
fastback-0ddc5ca8ab7ad7b6534077760f81605eb0df7f5f.zip
RPM based install
- add install rules to Makefile - get config file from /etc - add dist rules to Makefile - have fastback-check use fastback and fastback-unload-receipt from PATH - add spec file
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile132
1 files changed, 132 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d20c072..271ea76 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,15 @@
+NAME=fastback
+
+ifndef DESTDIR
+DESTDIR=/
+endif
+
+
+#
+# RPM specific setup stuff
+#
+
default: fastback
fastback: fastback.o
@@ -7,3 +18,124 @@ fastback: fastback.o
fastback.o: fastback.cpp
g++ -g -c -o $$(curl-config --cflags) $@ $<
+install:
+ install -d $(DESTDIR)/bin/ $(DESTDIR)/etc
+ install fastback fastback-unload-receipt $(DESTDIR)/bin/
+ install fastback.conf $(DESTDIR)/etc
+
+uninstall:
+ rm -rf $(DESTDIR)/bin/{fastback,fastback-unload-receipt}
+ rm -rf $(DESTDIR)/etc/fastback.conf
+
+clean:
+ rm -rf fastback.o fastback
+
+
+
+
+#
+# Maintainer
+#
+
+#
+# RPM Setup stuff
+#
+
+
+SPECFILE=$(NAME).spec
+
+## a base directory where we'll put as much temporary working stuff as we can
+ifndef WORKDIR
+WORKDIR := $(shell pwd)
+endif
+## of course all this can also be overridden in your RPM macros file,
+## but this way you can separate your normal RPM setup from your CVS
+## setup. Override RPM_WITH_DIRS in ~/.cvspkgsrc to avoid the usage of
+## these variables.
+SRCRPMDIR ?= $(WORKDIR)/SRPMS
+BUILDDIR ?= $(WORKDIR)/BUILD
+RPMDIR ?= $(WORKDIR)/RPMS
+MOCKDIR ?= $(WORKDIR)
+
+## SOURCEDIR is special; it has to match the CVS checkout directory,
+## because the CVS checkout directory contains the patch files. So it basically
+## can't be overridden without breaking things. But we leave it a variable
+## for consistency, and in hopes of convincing it to work sometime.
+ifndef SOURCEDIR
+SOURCEDIR := $(shell pwd)
+endif
+ifndef SPECDIR
+SPECDIR := $(shell pwd)
+endif
+
+# --define "_builddir $(BUILDDIR)" \
+
+ifndef RPM_DEFINES
+RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
+ --define "_specdir $(SPECDIR)" \
+ --define "_srcrpmdir $(SRCRPMDIR)" \
+ --define "_rpmdir $(RPMDIR)"
+endif
+
+# Initialize the variables that we need, but are not defined
+# the version of the package
+
+VER_REL := $(shell rpm $(RPM_DEFINES) -q --qf "%{VERSION} %{RELEASE}\n" --specfile $(SPECFILE)| head -1)
+
+ifndef NAME
+$(error "You can not run this Makefile without having NAME defined")
+endif
+ifndef VERSION
+VERSION := $(word 1, $(VER_REL))
+endif
+# the release of the package
+ifndef RELEASE
+RELEASE := $(word 2, $(VER_REL))
+endif
+
+# RPM with all the overrides in place; you can override this in your
+# .cvspkgsrc also, to use a default rpm setup
+# the rpm build command line
+ifndef RPM
+RPM := rpmbuild
+endif
+ifndef RPM_WITH_DIRS
+RPM_WITH_DIRS = $(RPM) $(RPM_DEFINES)
+endif
+
+#
+# Actual Maintainer rules
+#
+
+TARFILES=fastback.cpp Makefile fastback.conf fastback-check test fastback-unload-receipt
+TARFILENAME=$(NAME)-$(VERSION).tar.gz
+
+# This should be changed to build on dist, when I build a dist
+$(TARFILENAME): $(SPECFILE) $(TARFILES)
+ rm -rf $(NAME)-$(VERSION)
+ mkdir $(NAME)-$(VERSION)
+ cp -r $(TARFILES) $(NAME)-$(VERSION)
+ tar zcf $@ $(NAME)-$(VERSION)
+ rm -rf $(NAME)-$(VERSION)
+
+dist: $(TARFILENAME)
+
+maintainer-clean: clean
+ rm -rf $(TARFILENAME)
+
+#
+# RPM install
+#
+
+rpm-ver-rel:
+ @echo $(VERSION) $(RELEASE)
+
+srpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) -bs $<
+
+rpm: $(SPECFILE) $(NAME)-$(VERSION).tar.gz
+ $(RPM_WITH_DIRS) -ba $(SPECFILE) 2>&1 | tee .build-$(VERSION)-$(RELEASE).log ; exit $${PIPESTATUS[0]}
+
+rpm-clean: maintainer-clean
+ rm -rf RPMS SRPMS rpmbuild
+