1CC ?= $(CROSS_COMPILE)gcc 2LD ?= $(CROSS_COMPILE)ld 3AR ?= $(CROSS_COMPILE)ar 4NM ?= $(CROSS_COMPILE)nm 5OBJCOPY ?= $(CROSS_COMPILE)objcopy 6OBJDUMP ?= $(CROSS_COMPILE)objdump 7READELF ?= $(CROSS_COMPILE)readelf 8 9PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 10 11PLUGIN = $(PLUGIN_UUID).plugin 12PLUGIN_SRS = $(wildcard ./*.c) 13PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) 14PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include 15 16PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) 17PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC 18PLUGIN_LDFLAGS = $(LDFLAGS) -shared 19 20.PHONY: all 21all: $(PLUGIN) 22 23$(PLUGIN): $(PLUGIN_OBJ) 24 $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ 25 26%.o: %.c 27 $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o 28 29.PHONY: clean 30clean: 31 $(RM) $(PLUGIN_OBJ) $(PLUGIN_UUID).plugin 32 33