aboutsummaryrefslogtreecommitdiffstats
path: root/roms/skiboot/libstb/tss2/ibmtpm20tss/utils/makefile.nofile
blob: 3d22cc4fcb9fd5bda88dc1bd69f36d6006a70595 (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#################################################################################
#										#
#		Linux TPM2 Utilities Makefile for TSS without files		#
#			     Written by Ken Goldman				#
#		       IBM Thomas J. Watson Research Center			#
#										#
# (c) Copyright IBM Corporation 2016 - 2019					#
# 										#
# All rights reserved.								#
# 										#
# Redistribution and use in source and binary forms, with or without		#
# modification, are permitted provided that the following conditions are	#
# met:										#
# 										#
# Redistributions of source code must retain the above copyright notice,	#
# this list of conditions and the following disclaimer.				#
# 										#
# Redistributions in binary form must reproduce the above copyright		#
# notice, this list of conditions and the following disclaimer in the		#
# documentation and/or other materials provided with the distribution.		#
# 										#
# Neither the names of the IBM Corporation nor the names of its			#
# contributors may be used to endorse or promote products derived from		#
# this software without specific prior written permission.			#
# 										#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS		#
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT		#
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR		#
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT		#
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,	#
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT		#
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,		#
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY		#
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT		#
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE		#
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.		#
#										#
#################################################################################

# makefile to build a TSS library that does not require file read/write.
#
# See the documentation for limitations.

# C compiler

CC = /usr/bin/gcc

# compile - common flags for TSS library and applications

CCFLAGS  += 	-DTPM_POSIX			\
		-DTPM_TSS_NOFILE

# -DTPM_NOSOCKET

# compile - for TSS library

# include the hardening flag PIC needed for compiling for dynamic
# linking

CCLFLAGS += 	-I. 		\
		-fPIC		\
		-DTPM_TPM20

# compile - for applications

# include the hardening flag PIE needed for compiling for
# static linking

CCAFLAGS += 	-I.		\
		-DTPM_TPM20	\
		-fPIE

# link - common flags flags TSS library and applications

LNFLAGS += 	-DTPM_POSIX	\
		-L.

# link - for TSS library

# hardening flags for linking shared objects
LNLFLAGS += -shared -Wl,-z,now

#	This is an alternative to using the bfd linker on Ubuntu
LNLLIBS += -lcrypto

# link - for applications, TSS path, TSS and OpenSSl libraries

LNAFLAGS += -pie -Wl,-z,now -Wl,-rpath,.

LNALIBS +=  -libmtssutils -libmtssmin

# versioned shared library
LIBTSSVERSIONED=libibmtssmin.so.1.3

# soname field of the shared library
# which will be made symbolic link to the versioned shared library
# this is used to provide version backward-compatibility information
LIBTSSSONAME=libibmtssmin.so.1

# symbolic link to the versioned shared library
# this allows linking to the shared library with '-libmtss' 

os := $(shell uname -o)
ifeq ($(os),Cygwin)
  LIBTSS=libibmtssmin.dll
else
  LIBTSS=libibmtssmin.so
endif

# TSS utilities shared library

LIBTSSUTILSVERSIONED=libibmtssutils.so.1.3
LIBTSSUTILSSONAME=libibmtssutils.so.1
LIBTSSUTILS=libibmtssutils.so

# executable extension

EXE =

ALL = signapp writeapp

TSS_HEADERS = ibmtss/tssfile.h

# default TSS library

TSS_OBJS =  	tsscryptoh.o 		\
		tsscrypto.o 		\
		tssprintcmd.o

TSSUTILS_OBJS = cryptoutils.o	\
		ekutils.o	\
		imalib.o	\
		eventlib.o

# common to all builds

include makefile-common
include makefile-common20

# default build target

all: 	signapp writeapp

# TSS shared library source

tss.o: 			$(TSS_HEADERS) tss.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tss.c
tssauth.o: 		$(TSS_HEADERS) tssauth.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssauth.c
tssproperties.o: 	$(TSS_HEADERS) tssproperties.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssproperties.c
tssmarshal.o: 		$(TSS_HEADERS) tssmarshal.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssmarshal.c
tsscryptoh.o: 		$(TSS_HEADERS) tsscryptoh.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tsscryptoh.c
tsscrypto.o: 		$(TSS_HEADERS) tsscrypto.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tsscrypto.c
tssutils.o: 		$(TSS_HEADERS) tssutils.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssutils.c
tsssocket.o: 		$(TSS_HEADERS) tsssocket.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tsssocket.c
tssdev.o: 		$(TSS_HEADERS) tssdev.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssdev.c
tsstransmit.o: 		$(TSS_HEADERS) tsstransmit.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tsstransmit.c
tssresponsecode.o: 	$(TSS_HEADERS) tssresponsecode.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssresponsecode.c
tssccattributes.o: 	$(TSS_HEADERS) tssccattributes.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssccattributes.c
tssprint.o: 		$(TSS_HEADERS) tssprint.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssprint.c
tssprintcmd.o: 		$(TSS_HEADERS) tssprintcmd.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssprintcmd.c
Unmarshal.o: 		$(TSS_HEADERS) Unmarshal.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) Unmarshal.c
Commands.o: 		$(TSS_HEADERS) Commands.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) Commands.c
CommandAttributeData.o: $(TSS_HEADERS) CommandAttributeData.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) CommandAttributeData.c
ntc2lib.o:		$(TSS_HEADERS) ntc2lib.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) ntc2lib.c
tssntc.o:		$(TSS_HEADERS) tssntc.c
			$(CC) $(CCFLAGS) $(CCLFLAGS) tssntc.c

# TPM 2.0

tss20.o: 	$(TSS_HEADERS) tss20.c
		$(CC) $(CCFLAGS) $(CCLFLAGS) tss20.c
tssauth20.o: 	$(TSS_HEADERS) tssauth20.c
		$(CC) $(CCFLAGS) $(CCLFLAGS) tssauth20.c

# TSS utilities shared library source

cryptoutils.o: 	$(TSS_HEADERS) cryptoutils.c
		$(CC) $(CCFLAGS) $(CCLFLAGS) cryptoutils.c
ekutils.o: 	$(TSS_HEADERS) ekutils.c
		$(CC) $(CCFLAGS) $(CCLFLAGS) ekutils.c
imalib.o: 	$(TSS_HEADERS) imalib.c
		$(CC) $(CCFLAGS) $(CCLFLAGS) imalib.c
eventlib.o: 	$(TSS_HEADERS) eventlib.c
		$(CC) $(CCFLAGS) $(CCLFLAGS) eventlib.c

# TSS shared library build

$(LIBTSS): 	$(TSS_OBJS)
		$(CC) $(LNFLAGS) $(LNLFLAGS) -Wl,-soname,$(LIBTSSSONAME) -o $(LIBTSSVERSIONED) $(TSS_OBJS) $(LNLLIBS)
		rm -f $(LIBTSSSONAME)
		ln -sf $(LIBTSSVERSIONED) $(LIBTSSSONAME)
		rm -f $(LIBTSS)
		ln -sf $(LIBTSSSONAME) $(LIBTSS)

# TSS utilities shared library

$(LIBTSSUTILS):	$(TSSUTILS_OBJS)
		$(CC) $(LNFLAGS) $(LNLFLAGS) -Wl,-soname,$(LIBTSSUTILSSONAME) -o $(LIBTSSUTILSVERSIONED) $(TSSUTILS_OBJS) $(LNLLIBS)
		rm -f $(LIBTSSSUTILSONAME)
		ln -sf $(LIBTSSUTILSVERSIONED) $(LIBTSSUTILSSONAME)
		rm -f $(LIBTSSUTILS)
		ln -sf $(LIBTSSUTILSSONAME) $(LIBTSSUTILS)

.PHONY:		clean
.PRECIOUS:	%.o

clean:		
		rm -f *.o 		\
		$(LIBTSSSONAME)		\
		$(LIBTSSVERSIONED) 	\
		$(LIBTSSUTILSSONAME) 	\
		$(LIBTSSUTILSVERSIONED)	\
		$(ALL)

# applications

signapp:		ibmtss/tss.h signapp.o $(LIBTSS) $(LIBTSSUTILS)
			$(CC) $(LNFLAGS) $(LNAFLAGS) signapp.o $(LNALIBS) -o signapp
writeapp:		ibmtss/tss.h writeapp.o $(LIBTSS) $(LIBTSSUTILS) 
			$(CC) $(LNFLAGS) $(LNAFLAGS) writeapp.o $(LNALIBS) -o writeapp

# for applications, not for TSS library

%.o:		%.c ibmtss/tss.h 
		$(CC) $(CCFLAGS) $(CCAFLAGS) $< -o $@