Module: check_mk
Branch: master
Commit: c04fd9eaaa475abecc4bedaf7b8cea421551c325
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c04fd9eaaa475a…
Author: Alex Zurhake <az(a)mathias-kettner.de>
Date: Mon Nov 26 08:58:11 2018 +0100
Workaround to define all dependencies before including the package files
Change-Id: Id11b7cfb840431ee18abff13a448b036baa9fca7
---
omd/Makefile | 24 ++++++++++++++++++++++++
omd/packages/packages.make | 4 ----
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/omd/Makefile b/omd/Makefile
index a96bdb2..bd4a5de 100644
--- a/omd/Makefile
+++ b/omd/Makefile
@@ -1,6 +1,10 @@
SHELL = /bin/bash -e -o pipefail
+BUILD_HELPER_DIR := build-helper
+PACKAGE_DIR := $(shell pwd)/packages
+
include Makefile.omd
+include $(BUILD_HELPER_DIR)/build-helper-files.make
include packages/packages.make
# You can build singele packages by calling macke <PACKAGENAME>
@@ -64,6 +68,26 @@ endif
default: build
+# Workaround: Makefiles evaluate Variables the first time they are read. If a variable is
not set the
+# moment it is read, it is replaced with an empty string. Therefor our dependencies get
lost, if the
+# inlcuded Makefiles are not ordered correctly. For that reason, we parse the Makefiles
for certain
+# variable definitions and write them to an extra Makefile, which we include before the
package Makefile.
+$(BUILD_HELPER_DIR)/build-helper-files.make:
+ mkdir -p $(BUILD_HELPER_DIR)
+ $(RM) $@
+ for P in $(PACKAGES); do \
+ inc_path=$(PACKAGE_DIR)/$$P/$$P.make; \
+ if [[ $$P == 'enterprise' || $$P == 'managed' ]] ; then \
+ inc_path=$(REPO_PATH)/$$P/$$P.make; \
+ fi ; \
+ P_VAR=$$(echo $${P^^} | tr '-' '_' ); \
+ egrep -h "$$P_VAR\s:=\s" $$inc_path >> $@ ; \
+ egrep -h "$${P_VAR}_VERS\s:=\s" $$inc_path >> $@ ; \
+ egrep -h "$${P_VAR}_DIR\s:=\s" $$inc_path >> $@ ; \
+ egrep -h "$${P_VAR}_BUILD\s:=\s" $$inc_path >> $@ ; \
+ egrep -h "$${P_VAR}_INSTALL\s:=\s" $$inc_path >> $@ ; \
+ done
+
-include .config
DESTDIR ?=$(shell pwd)/destdir
diff --git a/omd/packages/packages.make b/omd/packages/packages.make
index 3563346..9fad5ba 100644
--- a/omd/packages/packages.make
+++ b/omd/packages/packages.make
@@ -17,10 +17,6 @@ TEST := $(shell which test)
TOUCH := $(shell which touch)
UNZIP := $(shell which unzip) -o
-# Helper files for timestamps
-BUILD_HELPER_DIR := build-helper
-PACKAGE_DIR := $(shell pwd)/packages
-
# Rules for patching
$(BUILD_HELPER_DIR)/%-patching: $(BUILD_HELPER_DIR)/%-unpack
set -e ; DIR=$$($(ECHO) $* | $(SED) 's/-[0-9.]\+.*//'); \