1 # -*- Mode: makefile -*-
3 # This Makefile example is fairly independent from the main makefile
4 # so users can take and adapt it for their build. We only really
5 # include config-host.mak so we don't have to repeat probing for
6 # programs that the main configure has already done for us.
9 include config-host.mak
11 TOP_SRC_PATH
= $(SRC_PATH
)/..
/..
21 # The lockstep example communicates using unix sockets,
22 # and can't be easily made to work on windows.
23 ifneq ($(CONFIG_WIN32
),y
)
33 ifeq ($(CONFIG_WIN32
),y
)
35 LDLIBS
+= $(shell $(PKG_CONFIG
) --libs glib-2.0
)
40 SONAMES
:= $(addsuffix $(SO_SUFFIX
),$(addprefix lib
,$(NAMES
)))
42 # The main QEMU uses Glib extensively so it is perfectly fine to use it
43 # in plugins (which many example do).
44 PLUGIN_CFLAGS
:= $(shell $(PKG_CONFIG
) --cflags glib-2.0
)
45 PLUGIN_CFLAGS
+= -fPIC
-Wall
46 PLUGIN_CFLAGS
+= -I
$(TOP_SRC_PATH
)/include/qemu
48 # Helper that honours V=1 so we get some output when compiling
49 quiet-@
= $(if
$(V
),,@
$(if
$1,printf
" %-7s %s\n" "$(strip $1)" "$(strip $2)" && ))
50 quiet-command
= $(call quiet-@
,$2,$3)$1
52 # for including , in command strings
58 $(call quiet-command
, \
59 $(CC
) $(CFLAGS
) $(PLUGIN_CFLAGS
) -c
-o
$@
$<, \
62 ifeq ($(CONFIG_WIN32
),y
)
63 lib
%$(SO_SUFFIX
): %.o win32_linker.o ..
/..
/plugins
/libqemu_plugin_api.a
64 $(call quiet-command
, \
65 $(CC
) -shared
-o
$@
$^
$(LDLIBS
), \
67 else ifeq ($(CONFIG_DARWIN
),y
)
69 $(call quiet-command
, \
70 $(CC
) -bundle
-Wl
$(COMMA
)-undefined
$(COMMA
)dynamic_lookup
-o
$@
$^
$(LDLIBS
), \
74 $(call quiet-command
, \
75 $(CC
) -shared
-o
$@
$^
$(LDLIBS
), \
81 rm -f
*.o
*$(SO_SUFFIX
) *.d