# These are some standard dependencies rules common to all Makefiles.

COMPILE = $(filter-out $(NOCFLAGS-$(<F)), $(filter-out $(nocflags),\
$(CC) $(cflags) $(CFLAGS) $(CFLAGS-$(<F)) $(CFLAGS-$(DIRSTEM))) \
$(DEFS-$(<F)) $(DEFS-$(DIRSTEM)))

#
# compile rule
#
define CC_TEMPLATE
$(1).o: $(srcdir)/$(1).c
	$(AM_V_CC)$(COMPILE) -Wp,-MD,.deps/$$(@:.o=.P) -c $$< -o $$@
endef
$(foreach FILE,$(COBJS:.c=),$(eval $(call CC_TEMPLATE,$(FILE))))

#
# dependencies
#
DEP_FILES = $(addprefix ./.deps/, $(patsubst %.o,%.P,$(OBJS)))

# These are automatically remade, no need for make to worry about
# them.
.PHONY : $(DEP_FILES)

DEPS_MAGIC := $(shell mkdir ./.deps > /dev/null 2>&1 || :)

.SECONDARY : $(DEP_FILES)

-include $(DEP_FILES) /dev/null
