• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/make -f
2
3#define variables
4TOOLS_INSTALL_DIR = $(epidinstalldir)/tools
5
6EXTRACTGRPS_INCLUDE_DIR = ./extractgrps
7EXTRACTGRPS_SRC = $(wildcard ./extractgrps/src/*.c)
8EXTRACTGRPS_OBJ = $(EXTRACTGRPS_SRC:.c=.o)
9EXTRACTGRPS_EXE = ./extractgrps/src/extractgrps$(EXE_EXTENSION)
10
11EXTRACTKEYS_INCLUDE_DIR = ./extractkeys
12EXTRACTKEYS_SRC = $(wildcard ./extractkeys/src/*.c)
13EXTRACTKEYS_OBJ = $(EXTRACTKEYS_SRC:.c=.o)
14EXTRACTKEYS_EXE = ./extractkeys/src/extractkeys$(EXE_EXTENSION)
15
16REVOKEGRP_INCLUDE_DIR = ./revokegrp
17REVOKEGRP_SRC = $(wildcard ./revokegrp/src/*.c)
18REVOKEGRP_OBJ = $(REVOKEGRP_SRC:.c=.o)
19REVOKEGRP_EXE = ./revokegrp/src/revokegrp$(EXE_EXTENSION)
20
21REVOKEKEY_INCLUDE_DIR = ./revokekey
22REVOKEKEY_SRC = $(wildcard ./revokekey/src/*.c)
23REVOKEKEY_OBJ = $(REVOKEKEY_SRC:.c=.o)
24REVOKEKEY_EXE = ./revokekey/src/revokekey$(EXE_EXTENSION)
25
26REVOKESIG_INCLUDE_DIR = ./revokesig
27REVOKESIG_SRC = $(wildcard ./revokesig/src/*.c)
28REVOKESIG_OBJ = $(REVOKESIG_SRC:.c=.o)
29REVOKESIG_EXE = ./revokesig/src/revokesig$(EXE_EXTENSION)
30
31EPID_SDK_ROOT_DIR = ..
32EXAMPLE_DIR = $(EPID_SDK_ROOT_DIR)/example
33LIB_ARGTABLE_DIR = $(EPID_SDK_ROOT_DIR)/ext/argtable3
34LIB_UTIL_DIR = $(EPID_SDK_ROOT_DIR)/example/util/src
35LIB_IPPCP_DIR = $(EPID_SDK_ROOT_DIR)/ext/ipp/sources/ippcp/src
36LIB_MEMBER_DIR = $(EPID_SDK_ROOT_DIR)/epid/member
37LIB_COMMON_DIR = $(EPID_SDK_ROOT_DIR)/epid/common
38
39#set linker flags
40LDFLAGS += -L$(LIB_UTIL_DIR) \
41	-L$(LIB_ARGTABLE_DIR) \
42	-L$(LIB_IPPCP_DIR) \
43	-L$(LIB_COMMON_DIR) \
44	-lcommon \
45	-lippcp -lutil -largtable3
46
47$(EXTRACTGRPS_EXE): $(EXTRACTGRPS_OBJ)
48	$(CC) -o $@ $^ $(LDFLAGS)
49
50$(EXTRACTGRPS_OBJ): %.o: %.c
51	$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
52			-I${EXAMPLE_DIR} -I$(EXTRACTGRPS_INCLUDE_DIR) \
53			-I${LIB_ARGTABLE_DIR} \
54			-c $^
55
56$(EXTRACTKEYS_EXE): $(EXTRACTKEYS_OBJ)
57	$(CC) -o $@ $^ $(LDFLAGS)
58
59$(EXTRACTKEYS_OBJ): %.o: %.c
60	$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
61			-I${EXAMPLE_DIR} -I$(EXTRACTKEYS_INCLUDE_DIR) \
62			-I${LIB_ARGTABLE_DIR} \
63			-c $^
64
65$(REVOKEGRP_EXE): $(REVOKEGRP_OBJ)
66	$(CC) -o $@ $^ $(LDFLAGS)
67
68$(REVOKEGRP_OBJ): %.o: %.c
69	$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
70			-I${EXAMPLE_DIR} -I$(REVOKEGRP_INCLUDE_DIR) \
71			-I${LIB_ARGTABLE_DIR} \
72			-c $^
73
74MEMBER_LIBS = -lmember
75ifneq ($(TINY),)
76    MEMBER_LIBS += -lmath -ltiny_stdlib
77endif
78$(REVOKEKEY_EXE): $(REVOKEKEY_OBJ)
79	$(CC) -o $@ $^ -L$(LIB_MEMBER_DIR) $(MEMBER_LIBS) $(LDFLAGS)
80
81$(REVOKEKEY_OBJ): %.o: %.c
82	$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
83			-I$(LIB_MEMBER_DIR)/../.. \
84			-I${EXAMPLE_DIR} -I$(REVOKEKEY_INCLUDE_DIR) \
85			-I${LIB_ARGTABLE_DIR} \
86			-c $^
87
88$(REVOKESIG_EXE): $(REVOKESIG_OBJ)
89	$(CC) -o $@ $^ $(LDFLAGS)
90
91$(REVOKESIG_OBJ): %.o: %.c
92	$(CC) -o $@ $(CFLAGS) -I$(EPID_SDK_ROOT_DIR) \
93			-I${EXAMPLE_DIR} -I$(REVOKESIG_INCLUDE_DIR) \
94			-I${LIB_ARGTABLE_DIR} \
95			-c $^
96
97#target part
98build: all install
99
100all: $(EXTRACTGRPS_EXE) $(EXTRACTKEYS_EXE) $(REVOKEGRP_EXE) $(REVOKEKEY_EXE) $(REVOKESIG_EXE)
101
102install:
103	mkdir -p '$(TOOLS_INSTALL_DIR)'
104	cp $(EXTRACTGRPS_EXE) $(EXTRACTKEYS_EXE) $(REVOKEGRP_EXE) $(REVOKEKEY_EXE) $(REVOKESIG_EXE) \
105		'$(TOOLS_INSTALL_DIR)'
106
107clean:
108	rm -f $(EXTRACTGRPS_EXE) $(EXTRACTKEYS_EXE) $(REVOKEGRP_EXE) $(REVOKEKEY_EXE) $(REVOKESIG_EXE) \
109	$(EXTRACTGRPS_OBJ) $(EXTRACTKEYS_OBJ) $(REVOKEGRP_OBJ) $(REVOKEKEY_OBJ) $(REVOKESIG_OBJ)
110