2 # Don't use implicit rules or variables
3 # we have explicit rules for everything
6 # Files with this suffixes are final, don't try to generate them
14 # Flags for dependency generation
15 QEMU_DGFLAGS
+= -MMD
-MP
-MT
$@
-MF
$(*D
)/$(*F
).d
18 $(call quiet-command
,$(CC
) $(QEMU_INCLUDES
) $(QEMU_CFLAGS
) $(QEMU_DGFLAGS
) $(CFLAGS
) -c
-o
$@
$<," CC $(TARGET_DIR)$@")
22 @echo
"missing libtool. please install and rerun configure"; exit
1
25 $(call quiet-command
,$(LIBTOOL
) --mode
=compile
--quiet
--tag
=CC
$(CC
) $(QEMU_INCLUDES
) $(QEMU_CFLAGS
) $(QEMU_DGFLAGS
) $(CFLAGS
) -c
-o
$@
$<," lt CC $@")
29 $(call quiet-command
,$(CC
) $(QEMU_INCLUDES
) $(QEMU_CFLAGS
) $(QEMU_DGFLAGS
) $(CFLAGS
) -c
-o
$@
$<," AS $(TARGET_DIR)$@")
32 $(call quiet-command
,$(CC
) $(QEMU_INCLUDES
) $(QEMU_CFLAGS
) $(QEMU_DGFLAGS
) $(CFLAGS
) -c
-o
$@
$<," OBJC $(TARGET_DIR)$@")
34 LINK
= $(call quiet-command
,$(CC
) $(QEMU_CFLAGS
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$(sort $(1)) $(LIBS
)," LINK $(TARGET_DIR)$@")
40 $(call quiet-command
,rm -f
$@
&& $(AR
) rcs
$@
$^
," AR $(TARGET_DIR)$@")
42 quiet-command
= $(if
$(V
),$1,$(if
$(2),@echo
$2 && $1, @
$1))
45 # Usage: CFLAGS+=$(call cc-option, -falign-functions=0, -malign-functions=0)
47 cc-option
= $(if
$(shell $(CC
) $1 $2 -S
-o
/dev
/null
-xc
/dev
/null \
48 >/dev
/null
2>&1 && echo OK
), $2, $3)
50 VPATH_SUFFIXES
= %.c
%.h
%.S
%.m
%.mak
%.texi
%.sh
51 set-vpath
= $(if
$1,$(foreach PATTERN
,$(VPATH_SUFFIXES
),$(eval vpath
$(PATTERN
) $1)))
54 # Usage: $(call find-in-path, prog)
55 # Looks in the PATH if the argument contains no slash, else only considers one
56 # specific directory. Returns an # empty string if the program doesn't exist
58 find-in-path
= $(if
$(find-string
/, $1), \
60 $(wildcard $(patsubst %, %/$1, $(subst :, ,$(PATH
)))))
62 # Generate files with tracetool
63 TRACETOOL
=$(PYTHON
) $(SRC_PATH
)/scripts
/tracetool.py
65 # Generate timestamp files for .h include files
68 @
test -f
$@ || cp
$< $@
71 $(call quiet-command
, sh
$(SRC_PATH
)/scripts
/create_config
< $< > $@
, " GEN $*.h")
72 @cmp
$@
$*.h
>/dev
/null
2>&1 || cp
$@
$*.h
74 # will delete the target of a rule if commands exit with a nonzero exit status