-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
70 lines (54 loc) · 1.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
O ?= out
OPTEE_CLIENT_EXPORT_PATH ?= ../optee_client/out/export/usr
ifeq ($(wildcard $(OPTEE_CLIENT_EXPORT_PATH)/include/tee_client_api.h),)
$(error OPTEE_CLIENT_EXPORT_PATH is not set or invalid)
endif
ifneq ($V,1)
export q := @
export echo := @echo
else
export q :=
export echo := @:
endif
ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
export echo := @:
endif
else # make-3.8x
ifneq ($(findstring s, $(MAKEFLAGS)),)
export echo := @:
endif
endif
VERSION = $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown)
CROSS_COMPILE ?= aarch64-linux-gnu-
CROSS_COMPILE_HOST ?= $(CROSS_COMPILE)
CC = $(CROSS_COMPILE_HOST)gcc
srcs := tee-stats.c
objs := $(patsubst %.c,$(O)/%.o, $(srcs))
CFLAGS += -DVERSION="$(VERSION)"
CFLAGS += -I. -I$(OPTEE_CLIENT_EXPORT_PATH)/include
LDFLAGS += -L$(OPTEE_CLIENT_EXPORT_PATH)/lib -lteec -lm
.PHONY: all
all: $(O)/tee-stats
$(O)/tee-stats: $(objs)
$(echo) ' CC $@'
$(q)$(CC) -o $@ $+ $(LDFLAGS)
$(O)/%.o: $(CURDIR)/%.c
$(q)mkdir -p $(O)
$(echo) ' CC $@'
$(q)$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
@echo ' CLEAN $(O)'
$(q)rm -f $(O)/tee-stats
$(q)rm -f $(objs)
$(q)if [ -e $(O) ]; then rmdir --ignore-fail-on-non-empty $(O); fi
.PHONY: install
install: all
$(echo) ' INSTALL $(DESTDIR)/bin/tee-stats'
$(q)mkdir -p $(DESTDIR)/bin
$(q)cp -a $(O)/tee-stats $(DESTDIR)/bin
.PHONY: uninstall
uninstall:
$(echo) ' UNINST $(DESTDIR)/bin/tee-stats'
$(q)rm -f $(DESTDIR)/bin/tee-stats