OBJECT_CONFIG_FILES = command_templates.cfg commands.cfg contact_templates.cfg contactgroup_templates.cfg contactgroups.cfg contacts.cfg host_templates.cfg hostgroup_templates.cfg hostgroups.cfg hosts.cfg service_templates.cfg servicegroup_templates.cfg servicegroups.cfg timeperiod_templates.cfg timeperiods.cfg services.cfg NAGIOS_OBJECT_DIR = /etc/icinga/objects EXPAND_HOSTSETS_CMD = ./expand-hostsets # A recipe to load a changed config file .timestamps/service-icinga-reload.timestamp: $(patsubst %, $(NAGIOS_OBJECT_DIR)/%, $(OBJECT_CONFIG_FILES)) service icinga reload touch $@ # A recipe to install a changed config file $(NAGIOS_OBJECT_DIR)/%: % cp $^ $@ # services.cfg is generated from services.cfg.in using expand-hostsets services.cfg: services.cfg.in hostgroups.cfg $(EXPAND_HOSTSETS_CMD) $(EXPAND_HOSTSETS_CMD) hostgroups.cfg services.cfg.in > $@ # Standard recipe to clean up. clean: rm -f $(patsubst %, $(NAGIOS_OBJECT_DIR)/%, $(OBJECT_CONFIG_FILES)) services.cfg .timestamps/*