+# Don't use implicit rules or variables
+# we have explicit rules for everything
+MAKEFLAGS += -rR
+
+# Files with this suffixes are final, don't try to generate them
+# using implicit rules
+%.d:
+%.h:
+%.c:
+%.m:
+%.mak:
+
%.o: %.c
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")
quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
# cc-option
-# Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0)
+# Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
+
+cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
+ >/dev/null 2>&1 && echo OK), $2, $3)
+
+# Generate timestamp files for .h include files
+
+%.h: %.h-timestamp
+ @test -f $@ || cp $< $@
-cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \
- > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;)
+%.h-timestamp: %.mak
+ $(call quiet-command, $(SRC_PATH)/create_config < $< > $@, " GEN $*.h")
+ @cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h