##
##
## These are per-file generators.
##
define gen-rule-o-from-c-by-name
$(2).o: $(1).c
	$$(E) "  CC      " $$@
	$$(Q) $$(CC) -c $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
endef

define gen-rule-i-from-c-by-name
$(2).i: $(1).c
	$$(E) "  CC      " $$@
	$$(Q) $$(CC) -E $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
endef

define gen-rule-s-from-c-by-name
$(2).s: $(1).c
	$$(E) "  CC      " $$@
	$$(Q) $$(CC) -S $$(CFLAGS) $$(cflags-y) $(3) -fverbose-asm $$< -o $$@
endef

define gen-rule-o-from-S-by-name
$(2).o: $(1).S
	$$(E) "  CC      " $$@
	$$(Q) $$(CC) -c $$(CFLAGS) $$(cflags-y) $(3) $$(ASMFLAGS) $(4) $$< -o $$@
endef

define gen-rule-d-from-c-by-name
$(2).d: $(1).c
	$$(E) "  DEP     " $$@
	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
endef

define gen-rule-d-from-S-by-name
$(2).d: $(1).S
	$$(E) "  DEP     " $$@
	$$(Q) $$(CC) -M -MT $$@ -MT $$(patsubst %.d,%.o,$$@) $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
endef

define gen-rule-i-from-S-by-name
$(2).i: $(1).S
	$$(E) "  CC      " $$@
	$$(Q) $$(CC) -E $$(CFLAGS) $$(cflags-y) $(3) $$< -o $$@
endef

##
## In case if someone add last resort rule
## together with .SUFFIXES not cleaned, this
## will slow down the build procedure
scripts/Makefile.rules::
	@true
