xref: /openbmc/qemu/contrib/plugins/Makefile (revision 812b31d3)
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
20NAMES += hwprofile
21
22SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES)))
23
24# The main QEMU uses Glib extensively so it's perfectly fine to use it
25# in plugins (which many example do).
26CFLAGS = $(GLIB_CFLAGS)
27CFLAGS += -fPIC
28CFLAGS += $(if $(findstring no-psabi,$(QEMU_CFLAGS)),-Wpsabi)
29CFLAGS += -I$(SRC_PATH)/include/qemu
30
31all: $(SONAMES)
32
33%.o: %.c
34	$(CC) $(CFLAGS) -c -o $@ $<
35
36lib%.so: %.o
37	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDLIBS)
38
39clean:
40	rm -f *.o *.so *.d
41	rm -Rf .libs
42
43.PHONY: all clean
44