diff --git a/Makefile b/Makefile index ab5e5c5c3..68ab52e9f 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,8 @@ REVISION ?= $(shell if [ -e .svn ]; then \ fi) VERSION := $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)$(REVISION)") DEBIAN_REVISION=1 +RPMTOPDIR ?= $(shell if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\ + else echo $$PWD/rpmbuilddir; fi) help: @echo " all : make all" @@ -397,8 +399,7 @@ scst-dist-gzip: scst-rpm: name=scst && \ - rpmtopdir="$$(if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\ - else echo $$PWD/rpmbuilddir; fi)" && \ + rpmtopdir=$(RPMTOPDIR) && \ $(MAKE) scst-dist-gzip && \ for d in BUILD RPMS SOURCES SPECS SRPMS; do \ mkdir -p $${rpmtopdir}/$$d; \ @@ -415,8 +416,7 @@ scst-rpm: scst-dkms-rpm: name=scst-dkms && \ - rpmtopdir="$$(if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\ - else echo $$PWD/rpmbuilddir; fi)" && \ + rpmtopdir=$(RPMTOPDIR) && \ $(MAKE) scst-dist-gzip && \ for d in BUILD RPMS SOURCES SPECS SRPMS; do \ mkdir -p $${rpmtopdir}/$$d; \ diff --git a/scstadmin/Makefile b/scstadmin/Makefile index 5ed1e3ac7..b0aa0a05f 100644 --- a/scstadmin/Makefile +++ b/scstadmin/Makefile @@ -67,6 +67,9 @@ DEFAULTDIR := $(shell if [ -f /etc/gentoo-release ]; then \ echo /etc/default; \ fi) +RPMTOPDIR ?= $(shell if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\ + else echo $$PWD/rpmbuilddir; fi) + all: cd $(SCSTADMIN_DIR) && $(MAKE) $@ @@ -139,8 +142,7 @@ dist-gzip: rpm: name=$(shell basename $$PWD) && \ - rpmtopdir="$$(if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\ - else echo $$PWD/rpmbuilddir; fi)" && \ + rpmtopdir=$(RPMTOPDIR) && \ $(MAKE) dist-gzip && \ for d in BUILD RPMS SOURCES SPECS SRPMS; do \ mkdir -p $${rpmtopdir}/$$d; \