From 3e9d6db60aaf7fb507aef98914e893be8ca40949 Mon Sep 17 00:00:00 2001 From: Kevin Dorner Date: Tue, 13 Sep 2022 05:06:26 +0200 Subject: [PATCH] Refactor and simplify Makefile --- Makefile | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 92915fb..19ffb97 100644 --- a/Makefile +++ b/Makefile @@ -3,27 +3,22 @@ PKG_VERSION := 3.9.2 PKG_OPSI_RELEASE := 1.0 PKG_DEB_RELEASE := 1 -# Sources and Checksums can be found on https://www.python.org/downloads/windows/ +# sources and checksums can be found on https://www.python.org/downloads/windows/ SOURCE_FILENAME := python-$(PKG_VERSION)-amd64.exe SOURCE := https://www.python.org/ftp/python/$(PKG_VERSION)/$(SOURCE_FILENAME) CHECKSUM := efb20aa1b648a2baddd949c142d6eb06 +default: fetch-sources patch-fields -#Variables below are set automatically -#DEB_CHANGELOG_VERSION := $(shell dpkg-parsechangelog -S Version | sed -rne 's|((-*[^-]+)+)(-[^-]+)|\1|p') - -# default target BUILDDIR := build -$(BUILDDIR): fetch-sources patch-fields +$(BUILDDIR): + mkdir -p $(BUILDDIR)/data -create-builddir: - [ -d "$(BUILDDIR)/data" ] || mkdir -p $(BUILDDIR)/data - -fetch-sources: create-builddir +fetch-sources: $(BUILDDIR) curl -o $(BUILDDIR)/data/$(SOURCE_FILENAME) $(SOURCE) echo "$(CHECKSUM) $(BUILDDIR)/data/$(SOURCE_FILENAME)" | md5sum -c -patch-fields: create-builddir +patch-fields: $(BUILDDIR) sed -e "s|@PKG_VERSION@|$(PKG_VERSION)|" \ -e "s|@PKG_OPSI_RELEASE@|$(PKG_OPSI_RELEASE)|" \ control.in > $(BUILDDIR)/control @@ -31,7 +26,6 @@ patch-fields: create-builddir clean: rm -rf $(BUILDDIR) - install: $(BUILDDIR) install -Dm644 $(BUILDDIR)/control -t $(DESTDIR)/srv/deploy/install/$(PKG_NAME) install -Dm644 $(BUILDDIR)/data/* -t $(DESTDIR)/srv/deploy/install/$(PKG_NAME)/data @@ -44,7 +38,8 @@ uninstall: package: dpkg-buildpackage --unsigned-source --unsigned-changes --no-check-builddeps -package-check: +# DEB_CHANGELOG_VERSION := $(shell dpkg-parsechangelog -S Version | sed -rne 's|((-*[^-]+)+)(-[^-]+)|\1|p') +package-check-changelog: @if [ "$(DEB_CHANGELOG_VERSION)" != "$(PKG_FULL_VERSION)" ]; then \ echo "Mismatch between debian changelog file and Makefile version"; \ echo "Debian changelog version: $(DEB_CHANGELOG_VERSION)"; \ @@ -53,4 +48,4 @@ package-check: fi -.PHONY: create-builddir fetch-sources patch-fields clean install uninstall package package-check +.PHONY: default fetch-sources patch-fields clean install uninstall package package-check-changelog