diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a1034ac
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,57 @@
+# Makefile for constructing RPMs.
+
+SHELL := bash
+.SHELLFLAGS := -eu -o pipefail -c
+NAME = cephadm
+DIST ?= el8
+BASE := "https://github.com/ceph/ceph"
+BRANCH := "octopus"
+VERSION ?= $(shell cat SPECS/cephadm.spec.in | awk '/Version/ { print $$2}')
+LOCALHASH := $(shell cat SPECS/cephadm.spec.in | awk '/Source0/ { print $$2}' | cut -d'/' -f7)
+RELEASE ?= $(shell cat SPECS/cephadm.spec.in | awk '/Release/ {print $$2}' | cut -d'%' -f1)
+# TODO: Make remote hash parametric
+REMOTEHASH := $(shell git ls-remote "https://github.com/ceph/ceph" "octopus" | awk '{print $$1}')
+SPECTOOL :=$(shell which spectool)
+RPMBUILD :=$(shell which rpmbuild)
+
+NVR := $(NAME)-$(VERSION)-$(RELEASE).$(DIST)
+
+all: spec src srpm
+
+pre:
+
+echo:	## Print the passed (or computed) parameters
+	echo PWD $(PWD)/SOURCES
+	echo BASE $(BASE)
+	echo BRANCH $(BRANCH)
+	echo CURRENT VERSION $(VERSION)
+	echo REMOTE HASH $(REMOTEHASH)
+	echo LOCAL HASH $(LOCALHASH)
+	$(eval RELEASE=$(shell echo $$(($(RELEASE)+1))))
+	echo RELEASE $(RELEASE)
+
+spec:	## Patch and build the cephadm spec file
+	sed SPECS/cephadm.spec.in \
+	  -e "s/$(LOCALHASH)/$(REMOTEHASH)/" \
+	  -e 's/@VERSION@/$(VERSION)/' \
+	  -e 's/@RELEASE@/$(RELEASE)/' \
+	 > SPECS/cephadm.spec
+	cp SPECS/cephadm.spec SPECS/cephadm.spec.in
+
+src:	## Download the cephadm sources according to the last hash
+	$(SPECTOOL) -g SPECS/cephadm.spec -C SOURCES -f
+
+srpm:	## Build the srpm
+	rpmbuild -bs $(PWD)/SPECS/cephadm.spec \
+	  --define "_sourcedir $(PWD)/SOURCES" \
+	  --define "_srcrpmdir $(PWD)" \
+	  --define "dist .$(DIST)"
+
+clean:  ## Clean the workdir
+	rm -f $(NVR).src.rpm
+	rm -f SPECS/cephadm.spec
+
+help:	## Print the Help
+	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile  | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
+
+.PHONY: all
diff --git a/SPECS/cephadm.spec b/SPECS/cephadm.spec
deleted file mode 100644
index b77eb95..0000000
--- a/SPECS/cephadm.spec
+++ /dev/null
@@ -1,59 +0,0 @@
-# Upstream ceph commit upon which this package is based:
-# patches_base=353d6970361a26381539b74a94bba8ac32666dc1
-
-Name:    cephadm
-Epoch:   2
-Version: 15.2.10
-Release: 2%{?dist}
-Summary: Utility to bootstrap Ceph clusters
-License: LGPL-2.1
-URL:     https://ceph.io
-Source0: https://github.com/ceph/ceph/raw/89ceb19fd8609fd4c99d10dd63f42e6786e37c86/src/cephadm/cephadm
-Source1: COPYING-LGPL2.1
-
-BuildArch: noarch
-
-Requires:       lvm2
-Requires:       python3
-Recommends:     podman
-%description
-Utility to bootstrap a Ceph cluster and manage Ceph daemons deployed
-with systemd and podman.
-
-%prep
-cp %{SOURCE0} .
-cp %{SOURCE1} .
-
-%build
-
-%install
-mkdir -p %{buildroot}%{_sbindir}
-install -m 0755 cephadm %{buildroot}%{_sbindir}/cephadm
-mkdir -p %{buildroot}%{_sharedstatedir}/cephadm
-chmod 0700 %{buildroot}%{_sharedstatedir}/cephadm
-mkdir -p %{buildroot}%{_sharedstatedir}/cephadm/.ssh
-chmod 0700 %{buildroot}%{_sharedstatedir}/cephadm/.ssh
-touch %{buildroot}%{_sharedstatedir}/cephadm/.ssh/authorized_keys
-chmod 0600 %{buildroot}%{_sharedstatedir}/cephadm/.ssh/authorized_keys
-
-%pre
-getent group cephadm >/dev/null || groupadd -r cephadm
-getent passwd cephadm >/dev/null || useradd -r -g cephadm -s /bin/bash -c "cephadm user for mgr/cephadm" -d %{_sharedstatedir}/cephadm cephadm
-exit 0
-
-%postun
-userdel -r cephadm || true
-exit 0
-
-%files
-%license COPYING-LGPL2.1
-%{_sbindir}/cephadm
-%attr(0700,cephadm,cephadm) %dir %{_sharedstatedir}/cephadm
-%attr(0700,cephadm,cephadm) %dir %{_sharedstatedir}/cephadm/.ssh
-%attr(0600,cephadm,cephadm) %{_sharedstatedir}/cephadm/.ssh/authorized_keys
-
-%changelog
-* Fri Mar 19 2021 Francesco Pantano <fpantano@redhat.com> - 2:15.2.10-2
-- 15.2.10 GA
-* Tue Mar 02 2021 Ken Dreyer <kdreyer@redhat.com> - 2:15.2.9-46
-- initial octopus package
diff --git a/SPECS/cephadm.spec.in b/SPECS/cephadm.spec.in
new file mode 100644
index 0000000..b77eb95
--- /dev/null
+++ b/SPECS/cephadm.spec.in
@@ -0,0 +1,59 @@
+# Upstream ceph commit upon which this package is based:
+# patches_base=353d6970361a26381539b74a94bba8ac32666dc1
+
+Name:    cephadm
+Epoch:   2
+Version: 15.2.10
+Release: 2%{?dist}
+Summary: Utility to bootstrap Ceph clusters
+License: LGPL-2.1
+URL:     https://ceph.io
+Source0: https://github.com/ceph/ceph/raw/89ceb19fd8609fd4c99d10dd63f42e6786e37c86/src/cephadm/cephadm
+Source1: COPYING-LGPL2.1
+
+BuildArch: noarch
+
+Requires:       lvm2
+Requires:       python3
+Recommends:     podman
+%description
+Utility to bootstrap a Ceph cluster and manage Ceph daemons deployed
+with systemd and podman.
+
+%prep
+cp %{SOURCE0} .
+cp %{SOURCE1} .
+
+%build
+
+%install
+mkdir -p %{buildroot}%{_sbindir}
+install -m 0755 cephadm %{buildroot}%{_sbindir}/cephadm
+mkdir -p %{buildroot}%{_sharedstatedir}/cephadm
+chmod 0700 %{buildroot}%{_sharedstatedir}/cephadm
+mkdir -p %{buildroot}%{_sharedstatedir}/cephadm/.ssh
+chmod 0700 %{buildroot}%{_sharedstatedir}/cephadm/.ssh
+touch %{buildroot}%{_sharedstatedir}/cephadm/.ssh/authorized_keys
+chmod 0600 %{buildroot}%{_sharedstatedir}/cephadm/.ssh/authorized_keys
+
+%pre
+getent group cephadm >/dev/null || groupadd -r cephadm
+getent passwd cephadm >/dev/null || useradd -r -g cephadm -s /bin/bash -c "cephadm user for mgr/cephadm" -d %{_sharedstatedir}/cephadm cephadm
+exit 0
+
+%postun
+userdel -r cephadm || true
+exit 0
+
+%files
+%license COPYING-LGPL2.1
+%{_sbindir}/cephadm
+%attr(0700,cephadm,cephadm) %dir %{_sharedstatedir}/cephadm
+%attr(0700,cephadm,cephadm) %dir %{_sharedstatedir}/cephadm/.ssh
+%attr(0600,cephadm,cephadm) %{_sharedstatedir}/cephadm/.ssh/authorized_keys
+
+%changelog
+* Fri Mar 19 2021 Francesco Pantano <fpantano@redhat.com> - 2:15.2.10-2
+- 15.2.10 GA
+* Tue Mar 02 2021 Ken Dreyer <kdreyer@redhat.com> - 2:15.2.9-46
+- initial octopus package