xref: /qemu/contrib/plugins/Makefile (revision e3a6e0da)
1# -*- Mode: makefile -*-
2#
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# cflags that the main configure has already done for us.
7#
8
9BUILD_DIR := $(CURDIR)/../..
10
11include $(BUILD_DIR)/config-host.mak
12
13VPATH += $(SRC_PATH)/contrib/plugins
14
15NAMES :=
16NAMES += hotblocks
17NAMES += hotpages
18NAMES += howvec
19NAMES += lockstep
20
21SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES)))
22
23# The main QEMU uses Glib extensively so it's perfectly fine to use it
24# in plugins (which many example do).
25CFLAGS = $(GLIB_CFLAGS)
26CFLAGS += -fPIC
27CFLAGS += $(if $(findstring no-psabi,$(QEMU_CFLAGS)),-Wpsabi)
28CFLAGS += -I$(SRC_PATH)/include/qemu
29
30all: $(SONAMES)
31
32%.o: %.c
33	$(CC) $(CFLAGS) -c -o $@ $<
34
35lib%.so: %.o
36	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDLIBS)
37
38clean:
39	rm -f *.o *.so *.d
40	rm -Rf .libs
41
42.PHONY: all clean
43