# 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
#
%.o: %.c
	@echo "$(COMPILE) -c $< -o $@"; \
	$(COMPILE) -Wp,-MD,.deps/$(@:.o=.P) -c $< -o $@

%.o: %.S
	@echo '$(COMPILE) -c $< -o $@'; \
	$(COMPILE) -Wp,-MD,.deps/$(@:.o=.P) -c $< -o $@

%.o: %.s
	@echo "$(COMPILE) -c $< -o $@"; \
	$(COMPILE) -Wp,-MD,.deps/$(@:.o=.P) -c $< -o $@

#
# 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
