forked from deislabs/mystikos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
254 lines (204 loc) · 6.85 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
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
244
245
246
247
248
249
250
251
252
253
254
.PHONY: tests
SUBDIR = top
TOP = $(abspath $(CURDIR))
include $(TOP)/defs.mak
VERSION=$(shell cat VERSION)
PKGNAME=mystikos-$(VERSION)-x86_64
TARBALL=$(PKGNAME).tar.gz
all:
$(MAKE) .git/hooks/pre-commit
$(MAKE) dirs
.git/hooks/pre-commit:
cp scripts/pre-commit .git/hooks/pre-commit
##==============================================================================
##
## dirs:
##
##==============================================================================
# CAUTION: this must be run before all other targets
ifndef MYST_IGNORE_PREREQS
DIRS += prereqs
endif
DIRS += third_party
ifdef MYST_ENABLE_GCOV
DIRS += gcov
endif
DIRS += json
DIRS += utils
ifdef MYST_ENABLE_EXT2FS
DIRS += ext2
endif
ifdef MYST_ENABLE_HOSTFS
DIRS += hostfs
endif
DIRS += host
DIRS += target
DIRS += kernel
DIRS += crt
DIRS += oe
DIRS += tools
ifdef MYST_WORLD
DIRS += alpine/docker
DIRS += tests
endif
CLEAN = $(BUILDDIR) $(TARBALL)
REDEFINE_TESTS=1
REDEFINE_CLEAN=1
include $(TOP)/rules.mak
##==============================================================================
##
## world: build the whole world (third-party + Mystikos + tests)
##
##==============================================================================
world:
$(MAKE) MYST_WORLD=1
##==============================================================================
##
## clean:
##
##==============================================================================
clean:
$(MAKE) __clean MYST_WORLD=1
##==============================================================================
##
## distclean:
##
##==============================================================================
distclean: clean
sudo rm -rf $(TOP)/build
make distclean -C $(TOP)/third_party/
##==============================================================================
##
## size: print the executable size of various components
##
##==============================================================================
size:
@ size -d $(BUILDDIR)/lib/openenclave/mystenc.so
@ size -d $(BUILDDIR)/lib/libmystkernel.so
@ size -d $(BUILDDIR)/lib/libmystcrt.so
##==============================================================================
##
## install:
## uninstall:
##
##==============================================================================
INSTALL=install -D
INSTDIR=$(DESTDIR)/$(MYST_PREFIX)
install:
rm -rf $(INSTDIR)
$(INSTALL) $(BINDIR)/myst $(INSTDIR)/bin/myst
$(INSTALL) $(LIBDIR)/libmystcrt.so $(INSTDIR)/lib/libmystcrt.so
$(INSTALL) $(LIBDIR)/libmystkernel.so $(INSTDIR)/lib/libmystkernel.so
$(INSTALL) $(LIBDIR)/openenclave/mystenc.so $(INSTDIR)/lib/openenclave/mystenc.so
$(INSTALL) $(BUILDDIR)/openenclave/bin/oegdb $(INSTDIR)/bin/myst-gdb
$(INSTALL) ./scripts/appbuilder $(INSTDIR)/bin/myst-appbuilder
$(INSTALL) include/myst/tee.h $(INSTDIR)/include/myst/tee.h
rm -rf $(INSTDIR)/lib/openenclave/debugger
cp -r $(BUILDDIR)/openenclave/lib/openenclave/debugger $(INSTDIR)/lib/openenclave/debugger
uninstall:
rm -rf $(MYST_PREFIX)
##==============================================================================
##
## src:
## Print the list of myst sources (excluding third-party sources)
##
##==============================================================================
src:
@ ./scripts/sources
##==============================================================================
##
## format:
## Format C source code within the source tree (exclude third_party)
##
##==============================================================================
format:
./scripts/code-format $(shell ./scripts/sources)
format-staged:
./scripts/code-format $(shell ./scripts/sources --staged)
##==============================================================================
##
## touch:
## touch all the myst source files
##
##==============================================================================
touch:
touch $(shell $(MAKE) src)
##==============================================================================
##
## attn:
## Find "ATTN" strings in source code
##
##==============================================================================
attn:
@ grep "ATTN" $(shell $(MAKE) src) | more
##==============================================================================
##
## tests:
##
##==============================================================================
summary:
@ SUMMARY=1 $(RUNTEST_COMMAND) /bin/true
tests:
@ $(MAKE) -C tests tests RUNTEST=$(RUNTEST_COMMAND)
@ $(MAKE) -s summary
alltests:
$(MAKE) tests ALLTESTS=1
##==============================================================================
##
## sub:
## Apply /tmp/sub.sed to all myst sources
##
##==============================================================================
sub:
@ $(TOP)/scripts/sub $(shell $(MAKE) src)
##==============================================================================
##
## bindist:
## Create a binary distribution based on the VERSION file
##
##==============================================================================
bindist:
@ rm -rf $(BUILDDIR)/bindist
@ $(MAKE) install DESTDIR=$(BUILDDIR)/bindist
@ ( cd $(BUILDDIR)/bindist/opt; tar zcf $(TARBALL) mystikos )
@ cp $(BUILDDIR)/bindist/opt/$(TARBALL) .
@ echo "=== Created $(TARBALL)"
##==============================================================================
##
## nolicense:
## Print names of source files without a license notice
##
##==============================================================================
nolicense:
@ $(foreach i, $(shell $(MAKE) src), ( grep -q -l "// Copyright (c)" $(i) || echo $(i) ) $(NL) )
##==============================================================================
##
## oelicense:
## Print names of source files with the OE license
##
##==============================================================================
oelicense:
@ $(foreach i, $(shell $(MAKE) src), ( grep -l "// Copyright (c) Open Enclave" $(i) || /bin/true ) $(NL) )
##==============================================================================
##
## help:
##
##==============================================================================
help:
@ echo ""
@ echo "make -- build everything"
@ echo "make clean -- remove generated binaries"
@ echo "make distclean -- remove build configuration and binaries"
@ echo "make tests -- run critical tests"
@ echo "make alltests -- run all tests"
@ echo "make install -- install the project"
@ echo "make uninstall -- uninstall the project"
@ echo "make touch -- touch all source files"
@ echo "make bindist -- generate a binary distribution file"
@ echo "make src -- print project source file names"
@ echo "make nolicense -- print source file names no license"
@ echo "make oelicense -- print source file names with OE SDK license"
@ echo "make sub -- perform global substitution using /tmp/sub.sed"
@ echo "make attn -- print sources with 'ATTN' annotations"
@ echo "make format -- format all sources"
@ echo ""