Add Hello World demo

This commit is contained in:
Tate, Hongliang Tian 2019-08-31 06:39:33 +00:00
parent 347791f235
commit ba78f09d1c
3 changed files with 34 additions and 0 deletions

2
demo/hello_world/.gitignore vendored Normal file

@ -0,0 +1,2 @@
hello_world
occlum_workspace

26
demo/hello_world/Makefile Normal file

@ -0,0 +1,26 @@
CC := musl-clang
CFLAGS := -fPIC -pie
.PHONY: all test test-native clean
all: hello_world
hello_world: hello_world.c
$(CC) $(CFLAGS) $^ -o $@
# Run hello_world on Occlum inside an SGX enclave
test:
rm -rf occlum_workspace
mkdir occlum_workspace
cd occlum_workspace && \
occlum init && \
cp ../hello_world image/bin && \
occlum build && \
occlum run /bin/hello_world
# Run hello_world on the native OS (e.g., Linux)
test-native:
./hello_world
clean:
rm -rf hello_world occlum_workspace

@ -0,0 +1,6 @@
#include <stdio.h>
int main() {
printf("Hello World\n");
return 0;
}