mirror of
https://github.com/clearlinux/graphene.git
synced 2026-04-28 19:23:39 +00:00
Instead of 'loader.debug_type', introduce 'loader.log_level' and 'loader.log_file', along with a set of definitions for logging at a chosen level. For now, the call sites keep using the legacy macros (SGX_DBG and debug()), because converting them all will conflict with other big changes in the code base. The existing LibOS calls are assumed to be at 'info' level.
73 lines
2.0 KiB
Makefile
73 lines
2.0 KiB
Makefile
# Use one of these commands to build the manifest for Node.js:
|
|
#
|
|
# - make
|
|
# - make DEBUG=1
|
|
# - make SGX=1
|
|
# - make SGX=1 DEBUG=1
|
|
#
|
|
# Use `make clean` to remove Graphene-generated files.
|
|
|
|
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
|
NODEJS_DIR ?= /usr/bin
|
|
|
|
# Relative path to Graphene root and key for enclave signing
|
|
GRAPHENEDIR ?= ../..
|
|
SGX_SIGNER_KEY ?= $(GRAPHENEDIR)/Pal/src/host/Linux-SGX/signer/enclave-key.pem
|
|
|
|
ifeq ($(DEBUG),1)
|
|
GRAPHENE_LOG_LEVEL = debug
|
|
else
|
|
GRAPHENE_LOG_LEVEL = error
|
|
endif
|
|
|
|
.PHONY: all
|
|
all: nodejs.manifest | pal_loader
|
|
ifeq ($(SGX),1)
|
|
all: nodejs.manifest.sgx nodejs.sig nodejs.token
|
|
endif
|
|
|
|
include ../../Scripts/Makefile.configs
|
|
|
|
# Generate manifest rules for Node.js dependencies.
|
|
# We'll duplicate some Glibc libraries (which Graphene provides in a customized version), but
|
|
# there's no harm in this.
|
|
.INTERMEDIATE: trusted-libs
|
|
trusted-libs: ../common_tools/get_deps.sh
|
|
../common_tools/get_deps.sh $(NODEJS_DIR)/nodejs > $@
|
|
|
|
nodejs.manifest: nodejs.manifest.template trusted-libs
|
|
(sed -e 's|$$(GRAPHENEDIR)|'"$(GRAPHENEDIR)"'|g' \
|
|
-e 's|$$(GRAPHENE_LOG_LEVEL)|'"$(GRAPHENE_LOG_LEVEL)"'|g' \
|
|
-e 's|$$(NODEJS_DIR)|'"$(NODEJS_DIR)"'|g' \
|
|
-e 's|$$(ARCH_LIBDIR)|'"$(ARCH_LIBDIR)"'|g' \
|
|
$<; \
|
|
cat trusted-libs) > $@
|
|
|
|
# Generate SGX-specific manifest, enclave signature, and token for enclave initialization
|
|
nodejs.manifest.sgx: nodejs.manifest helloworld.js
|
|
$(GRAPHENEDIR)/Pal/src/host/Linux-SGX/signer/pal-sgx-sign \
|
|
-libpal $(GRAPHENEDIR)/Runtime/libpal-Linux-SGX.so \
|
|
-key $(SGX_SIGNER_KEY) \
|
|
-manifest $< -output $@
|
|
|
|
nodejs.sig: nodejs.manifest.sgx
|
|
|
|
nodejs.token: nodejs.sig
|
|
$(GRAPHENEDIR)/Pal/src/host/Linux-SGX/signer/pal-sgx-get-token -output $@ -sig $<
|
|
|
|
pal_loader:
|
|
ln -s $(GRAPHENEDIR)/Runtime/pal_loader $@
|
|
|
|
.PHONY: check
|
|
check: all
|
|
./pal_loader ./nodejs helloworld.js > OUTPUT
|
|
@grep -q "Hello World" OUTPUT && echo "[ Success 1/1 ]"
|
|
@rm OUTPUT
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(RM) *.manifest *.manifest.sgx *.token *.sig pal_loader OUTPUT
|
|
|
|
.PHONY: distclean
|
|
distclean: clean
|