--- Build strict file-reference rules for GNU Makefiles
-- @module formats.gnumake.references

local gnumake_references = {}

-- Pattern breakdown: directives are anchored to the line; the second form reaches later whitespace-separated files
local include_first_prefix = "^%s*%-?include%s+"
local include_later_prefix = "^%s*%-?include%s+.-%s+"
local sinclude_first_prefix = "^%s*sinclude%s+"
local sinclude_later_prefix = "^%s*sinclude%s+.-%s+"

--- Return references from GNU Make include directives
-- @return table rules
function gnumake_references.new()
	return {
		{ prefix = include_first_prefix },
		{ prefix = include_later_prefix },
		{ prefix = sinclude_first_prefix },
		{ prefix = sinclude_later_prefix },
	}
end

return gnumake_references
