monitoring-plugins-cyconet/common.mk

67 lines
1.8 KiB
Makefile
Raw Permalink Normal View History

2013-11-18 09:38:03 +00:00
# import buildflags
CFLAGS += $(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS += $(shell dpkg-buildflags --get LDFLAGS)
# define common directories
2013-11-18 10:58:37 +00:00
PLUGINDIR := /usr/lib/monitoring-plugins/
2013-11-18 09:38:03 +00:00
CRONJOBDIR := /usr/lib/nagios/cronjobs
2013-11-18 10:58:37 +00:00
CONFIGDIR := /etc/monitoring-plugins/config
INIDIR := /etc/monitoring-plugins
2013-11-18 09:38:03 +00:00
CONFIGFILES := $(wildcard *.cfg)
# guess the name of the plugin to build if not defined
PLUGINNAME := $(shell basename $(CURDIR))
ifndef PLUGIN
PLUGIN := $(PLUGINNAME)
endif
2013-11-18 10:58:37 +00:00
DOCDIR := /usr/share/doc/monitoring-plugins-cyconet/$(PLUGINNAME)
2013-11-18 09:38:03 +00:00
# add some default files to clean
# we actually need strip here. make is weird sometimes.
CLEANEXTRAFILES := $(strip $(wildcard *.o) $(wildcard *.a) $(wildcard *.so))
# build the stuff actually
all:: $(PLUGIN) $(MANPAGES) $(INIFILES) $(CRONJOBS)
install::
install -d $(DESTDIR)$(PLUGINDIR)
install -m 755 -o root -g root $(PLUGIN) $(DESTDIR)$(PLUGINDIR)
ifdef CONFIGFILES
install -d $(DESTDIR)$(CONFIGDIR)
install -m 644 -o root -g root $(CONFIGFILES) $(DESTDIR)$(CONFIGDIR)
endif
ifdef MANPAGES
set -e; for m in $(MANPAGES); do \
section=`echo $$m | sed 's,\.gz$$,,;s,.*\.,,'` ;\
mandir="/usr/share/man/man$${section}" ;\
install -d $(DESTDIR)$${mandir} ;\
install -m 644 -o root -g root $${m} $(DESTDIR)$${mandir} ;\
done
endif
ifdef INIFILES
install -d $(DESTDIR)$(INIDIR)
install -m 644 -o root -g root $(INIFILES) $(DESTDIR)$(INIDIR)
endif
ifdef DOCFILES
install -d $(DESTDIR)$(DOCDIR)
install -m 644 -o root -g root $(DOCFILES) $(DESTDIR)$(DOCDIR)
endif
ifdef CRONJOBS
install -d $(DESTDIR)$(CRONJOBDIR)
install -m 755 -o root -g root $(CRONJOBS) $(DESTDIR)$(CRONJOBDIR)
endif
clean::
ifdef CLEANFILES
rm -f $(CLEANFILES)
endif
ifneq (,$(CLEANEXTRAFILES))
rm -f $(CLEANEXTRAFILES)
endif
.PHONY: clean