-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile.omd
46 lines (37 loc) · 1.84 KB
/
Makefile.omd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# General settings included by all packages
OMD_VERSION = 5.40-labs-edition
OMD_SERIAL = 66
OMD_PATCH_LEVEL = 1
OMD_BASE = /omd
OMD_PHYSICAL_BASE = /opt/omd
OMD_ROOT = $(OMD_BASE)/versions/$(OMD_VERSION)
PERL = /usr/bin/perl
P5TMPDIST = $(shell pwd)/../perl-modules/dist
# Determine the distro we are running on and its version. Nasty here:
# We do not known wether we are called from the main Makefile or
# from a package Makefile. There we do not know the path to the
# 'distro' script. We simply try out both paths...
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
DISTRO_INFO = $(shell $(ROOT_DIR)/distro 2>/dev/null || ./distro)
DISTRO_NAME = $(word 1, $(DISTRO_INFO))
DISTRO_VERSION = $(word 2, $(DISTRO_INFO))
# Depending on the distro we include a Makefile with distro-
# specific variables. Here the same problem appears again.
# Maybe anyone has a simpler solution?
DISTRO_FILE = $(ROOT_DIR)/distros/Makefile.$(DISTRO_NAME)_$(DISTRO_VERSION)
include $(DISTRO_FILE)
# Net result -> all Makefiles have now access to the linux distribution
# specific settings
# skip some packages on some distros
ifdef SKIP_PACKAGES
PACKAGES:=$(shell for p in $(PACKAGES); do skip=0; for s in $(SKIP_PACKAGES); do if [ "$$s" = "$$p" ]; then skip=1; fi; done; if [ $$skip -eq 0 ]; then echo $$p; fi; done)
endif
APACHE_VERSION = $(shell $(APACHE_BIN) -v | awk '/version/ {print $$3}' | awk -F/ '{print $$2}')
APACHE_VERSION_MAIN = $(word 1, $(subst ., ,$(APACHE_VERSION)))
APACHE_VERSION_SUB = $(word 2, $(subst ., ,$(APACHE_VERSION)))
APACHE_24_OR_NEWER = $(shell [ $(APACHE_VERSION_MAIN) -ge 2 -a $(APACHE_VERSION_SUB) -ge 4 ] && echo 1 || echo 0)
ifeq ($(APACHE_24_OR_NEWER),1)
APACHE_INCLUDEOPT = IncludeOptional
else
APACHE_INCLUDEOPT = Include
endif