1# -*- makefile -*- 2# 3# This is the Makefile.config file to use for a "clean" distribution. 4# 5# This file specifies where Munin will look for things after you've 6# run 'make' in the source directory. Modify it to suit your needs. 7 8# DESTDIR is meant only for use when making Munin packages. Unless 9# you're doing packaging do NOT set it. 10# DESTDIR is empty during building, and optionally set to point to 11# a shadow tree during make install. 12 13# Note: There is a need for a VARDIR, with DBDIR, PLUGSTATE, HTMLDIR 14# and LOGDIR as subdirectories. Today, DBDIR contains configured 15# domains, as well as PLUGSTATE, and we risk collisions. 16 17# 18# the base of the Munin installation. 19# 20PREFIX ?= $(DESTDIR)/opt/munin 21 22# Where Munin keeps its configurations (server.conf, client.conf, ++) 23CONFDIR ?= $(DESTDIR)/etc/opt/munin 24 25# Server only - where to put munin-cron 26BINDIR ?= $(PREFIX)/bin 27 28# Client only - where to put munin-node, munin-node-configure, and munin-run 29SBINDIR ?= $(PREFIX)/sbin 30 31# Where to put text and html documentation 32DOCDIR ?= $(PREFIX)/doc 33 34# Where to put man pages 35MANDIR ?= $(PREFIX)/man 36 37# Where to put internal binaries and plugin repository 38LIBDIR ?= $(PREFIX)/lib 39 40# Server only - Output directory 41HTMLDIR ?= $(PREFIX)/www/docs 42CGIDIR ?= $(PREFIX)/www/cgi 43 44# Where to put internal data for master (RRD, internal files, ...) 45DBDIR ?= $(DESTDIR)/var/opt/munin 46 47# Where to put internal data for node (plugin state, ...) 48DBDIRNODE ?= $(DESTDIR)/var/opt/munin-node 49 50# Client only - Where the spool files are written. Must be writable by 51# group "munin", and should be preserved between reboots 52SPOOLDIR ?= $(DBDIR)/spool 53 54# Client only - Where plugins should put their states. Must be writable by 55# group "munin", and should be preserved between reboots 56PLUGSTATE ?= $(DBDIRNODE)/plugin-state 57 58# Where Munin should place its logs. 59LOGDIR ?= $(PREFIX)/log/munin 60 61# Location of PID files and other statefiles. On the server, must be 62# writable by the user "munin". 63STATEDIR ?= $(DESTDIR)/var/run/munin 64 65# The perl interpreter to use 66PERL := /usr/local/bin/perl 67 68# The python interpreter to use (used by some plugins) 69PYTHON := /usr/local/bin/python3.8 70 71# The ruby interpreter to use (used by some plugins) 72RUBY := /usr/local/bin/ruby 73 74# The java runtime to use (used by some plugins) 75JAVARUN := /usr/local/bin/java 76 77# The java library dir to use (used by some plugins) 78# this is needed in order to be able to install 79# java libraries in a custom location. Many distributions 80# enforce a spesific location for java libraries. 81JAVALIBDIR = $(LIBDIR) 82 83 84# A modern (posix) shell. We're not looking for arrays, but $() and 85# other modern stuff is expected. On a posix-system the expression 86# below will find the right shell. Most Unixes released the last 10 87# years are POSIX compliant enough for this to work (he said bravely). 88# 89# On Linux /bin/sh, SunOS/Solaris /usr/xpg4/bin/sh or /bin/ksh 90# In general: bash or ksh will work 91# 92GOODSH := $(shell PATH=`getconf PATH 2>/dev/null || echo $(PATH)` LANG=C sh -c 'type sh | sed "s/.* //"') 93 94# Path of bash for bash specific plugins 95BASH := /usr/local/bin/bash 96 97# Server only - Where to install the perl libraries 98PERLLIB = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2) 99 100# Client only - Install plugins for this architecture 101# the LANG=C makes tr work as expected, not regarding any locale it 102# isn't done globally to enable users to have as much localized 103# errors as possible 104OSTYPE := freebsd 105 106# How to figure out the hostname. (Only used in default configuration 107# files) 108HOSTNAME := $(shell hostname) 109 110# What is the safest way to create a tempfile. 111# Default is to figure it out by testing various methods. 112# Replace this with a known platform-specific method 113MKTEMP := $(shell ./test-mktemp) 114 115# Munin version number. 116VERSION := $(shell ./getversion) 117 118# User to run munin as 119USER := munin 120GROUP := munin 121 122# Default user to run the plugins as 123PLUGINUSER := nobody 124 125# Default user to run the cgi as 126CGIUSER := nobody 127 128# Which command to use to check if the USER and GROUP to run Munin as, exists. 129ifneq ($(shell which getent),) 130 # "getent" works on most modern OS 131 CHECKUSER_COMMAND := getent passwd $(USER) 132 CHECKGROUP_COMMAND := getent group $(GROUP) 133else 134 ifeq ($(OSTYPE),darwin) 135 # This should work for OSX 10.5 (Leopard) or later 136 CHECKUSER_COMMAND := dscl . -read /Users/$(USER) 137 CHECKGROUP_COMMAND := dscl . -read /Groups/$(GROUP) 138 else 139 ifeq ($(OSTYPE),cygwin) 140 CHECKUSER_COMMAND := id $(USER) 141 CHECKGROUP_COMMAND := grep ^$(GROUP): /etc/group 142 else 143 ifeq ($(OSTYPE),hp-ux) 144 CHECKUSER_COMMAND := pwget -n $(USER) 145 CHECKGROUP_COMMAND := grget -n $(GROUP) 146 else 147 $(warning Missing test for user existence on this platform. Skipping this check and hoping for the best ...) 148 CHECKUSER_COMMAND := true 149 CHECKGROUP_COMMAND := true 150 endif 151 endif 152 endif 153endif 154CHECKUSER := $(shell $(CHECKUSER_COMMAND) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2")) 155CHECKGROUP := $(shell $(CHECKGROUP_COMMAND) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2")) 156 157CHOWN := chown 158CHMOD := chmod 159CHGRP := chgrp 160 161# Java compiler stuff - only needed on the buildhost 162JC := javac 163JFLAGS := -g -source 1.7 -target 1.7 -Xlint 164JAR := jar 165 166# Check if the java compiler works 167# Note that we defer JCVALID evaluation to runtime, 168# since $(JC) can be redefined later in a specific Makefile.config 169# The core Makefile.config is then used as a Makefile.default 170JCVALID = $(shell $(JC) -version >/dev/null 2>/dev/null && echo "yes") 171 172# Check whether setruid functionality can be used 173HASSETR := $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' ) 174