]>
Commit | Line | Data |
---|---|---|
17759187 | 1 | |
5ab28867 JQ |
2 | # Don't use implicit rules or variables |
3 | # we have explicit rules for everything | |
4 | MAKEFLAGS += -rR | |
5 | ||
6 | # Files with this suffixes are final, don't try to generate them | |
7 | # using implicit rules | |
8 | %.d: | |
9 | %.h: | |
10 | %.c: | |
11 | %.m: | |
12 | %.mak: | |
13 | ||
7ebf54bc SW |
14 | # Flags for dependency generation |
15 | QEMU_DGFLAGS += -MMD -MP -MT $@ | |
02d5467e | 16 | |
f527c579 | 17 | %.o: %.c $(GENERATED_HEADERS) |
7ebf54bc | 18 | $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@") |
17759187 AL |
19 | |
20 | %.o: %.S | |
7ebf54bc | 21 | $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@") |
17759187 AL |
22 | |
23 | %.o: %.m | |
7ebf54bc | 24 | $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") |
17759187 | 25 | |
fa394727 | 26 | LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS)," LINK $(TARGET_DIR)$@") |
3aa892d7 AL |
27 | |
28 | %$(EXESUF): %.o | |
0bfe3ca5 | 29 | $(call LINK,$^) |
4f188f88 | 30 | |
93a0dba7 | 31 | %.a: |
28c699a2 | 32 | $(call quiet-command,rm -f $@ && $(AR) rcs $@ $^," AR $(TARGET_DIR)$@") |
93a0dba7 | 33 | |
28c699a2 | 34 | quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) |
70071e17 JQ |
35 | |
36 | # cc-option | |
8a2e6ab5 | 37 | # Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0) |
70071e17 | 38 | |
fc3baad7 TM |
39 | cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ |
40 | >/dev/null 2>&1 && echo OK), $2, $3) | |
1215c6e7 JQ |
41 | |
42 | # Generate timestamp files for .h include files | |
43 | ||
44 | %.h: %.h-timestamp | |
45 | @test -f $@ || cp $< $@ | |
46 | ||
47 | %.h-timestamp: %.mak | |
3e65aaf5 | 48 | $(call quiet-command, sh $(SRC_PATH)/create_config < $< > $@, " GEN $*.h") |
1215c6e7 | 49 | @cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h |
90f445e1 MT |
50 | |
51 | # will delete the target of a rule if commands exit with a nonzero exit status | |
52 | .DELETE_ON_ERROR: |