# $HeadURL$ $LastChangedRevision$ # Functions define check_var_logical ifeq ($$(origin $(1)),undefined) $$(error $(1): not set) else ifeq ($$($(1)),false) else ifeq ($$($(1)),true) else $$(error $$($(1)): invalid value for $(1)) endif endef # $(foreach ...) outputs its list separated by spaces, as normal. The problem # with this is that even if I embed $(NEWLINE) after each string, there is of # course still a space after the newline. If I then change the newline+space # for a newline, then that just leaves one undesired trailing newline at the # end that results in a double empty line, but we can change that as well. # To make things clearer, I don't put a newline in with the $(foreach ...), # instead I put in the *text* 'NEWLINE_PLACEHOLDER', and then substitute that # out as described. define NEWLINE endef define check_var_against_list ifeq ($$(origin $(1)),undefined) $$(error $(1): not set) $(subst NEWLINE_PLACEHOLDER,,$(subst NEWLINE_PLACEHOLDER ,$(NEWLINE),$(foreach POSSIBLE_VAL,$(2),else ifeq '$$($(1))' '$(POSSIBLE_VAL)'NEWLINE_PLACEHOLDER))) else $$(error $$($(1)): invalid value for $(1)) endif endef define check_var_set ifeq ($$(origin $(1)),undefined) $$(error $(1): not set) endif endef # Variables SHELL = /bin/bash $(eval $(call check_var_set,SITE_CONFIG_DIR)) $(eval $(call check_var_set,PCMS_SHARE_PREFIX)) $(eval $(call check_var_set,PCMS_STATE_PREFIX)) OSID = $(shell lsb_release -i -r -s | tr -d '\n' | tr '[A-Z]' '[a-z]') ifndef HOSTNAME HOSTNAME = $(shell uname -n) endif # Make makes facilities; facilities require files and files require methods. # Therefore this one rule (which is also first and therefore default) should # be enough. ifeq ($(PCMS_PASS_NUM),3) all.facility: clean.facility: else ifeq ($(PCMS_PASS_NUM),2) all.facility: clean.facility: else ifeq ($(PCMS_PASS_NUM),1) all.facility: clean.facility: else ifeq ($(PCMS_PASS_NUM),0) all.facility: touch $@ clean.facility: $(RM) *.facility endif # A recipe that deliberately does not create its target, thus ensuring # that anything that depends on it will have its recipe run. force-execution-each-time: # Includes include $(PCMS_STATE_PREFIX)/makefiles/facility-local.mk # Take the list of module- and config-module- provided facilities, strip their # leading directories and include them. Note that: # 1) we strip the leading directories so that the include directory will load # then from the first-mentioned '-I' directory (which puts config-module # ahead of module) # 2) we don't bother deduplicating the list because all files should have # reinclusion protection. include $(notdir $(wildcard $(SITE_CONFIG_DIR)/makefiles/facilities/facility-*.mk $(PCMS_SHARE_PREFIX)/makefiles/facilities/facility-*.mk)) .SUFFIXES: