123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- subdirs = native
- SYS ?= $(shell gcc -dumpmachine)
- export SYS
- PALDIR = $(level)../../../Pal/src
- SHIMDIR = $(level)../src
- RUNTIME = $(level)../../../Runtime
- ifeq ($(SGX),1)
- PAL_LOADER = pal_loader SGX
- else
- PAL_LOADER = pal_loader
- endif
- CC = gcc
- CXX = g++
- CFLAGS = -std=gnu99
- CFLAGS-debug = $(CFLAGS) -I$(SHIMDIR)/../include -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib
- LDFLAGS =
- LDFLAGS-debug = $(LDFLAGS) -L$(SHIMDIR) -L$(PALDIR) -Wl,-rpath-link=$(abspath $(RUNTIME))
- default: all
- include $(PALDIR)/Makefile.Test
- all: pal_loader $(target) $(if $(level),,build-subdirs) | $(call expand_target,$(exec_target))
- ifeq ($(DEBUG),1)
- CC += -g
- CXX += -g
- endif
- export DEBUG
- ifeq ($(ABSPATH_IN_MANIFEST),yes)
- manifest_rules = \
- -e 's:\$$(PAL):$(abspath $(RUNTIME))/$(PAL_LOADER):g' \
- -e 's:\$$(PWD):$(PWD):g' \
- -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
- -e 's:\$$(SHIMPATH):$(abspath $(RUNTIME))/libsysdb.so:g' \
- -e 's:\$$(LIBCDIR):$(abspath $(RUNTIME)):g' \
- $(extra_rules)
- else
- manifest_rules= \
- -e 's:\$$(PAL):$(abspath $(RUNTIME))/$(PAL_LOADER):g' \
- -e 's:\$$(PWD):$(PWD):g' \
- -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
- -e 's:\$$(SHIMPATH):'$$RELDIR'$(RUNTIME)/libsysdb.so:g' \
- -e 's:\$$(LIBCDIR):'$$RELDIR'$(RUNTIME):g' \
- $(extra_rules)
- endif
- pal_loader:
- ln -sf $(RUNTIME)/pal_loader
- relative-to = $(shell python -c "import os.path; print os.path.relpath(\"$(abspath $2)\",\"$(abspath $1)\")")
- %manifest: %manifest.template
- @echo [ $@ ]
- RELDIR=$(filter-out ./,$(call relative-to,$(dir $@),$(shell pwd))/) && \
- sed $(manifest_rules) $< > $@
- (grep -q '^#!' $@ && chmod +x $@) || true
- manifest: manifest.template
- @echo [ $@ ]
- sed $(manifest_rules) $< > $@
- .PHONY: test clean
- clean: $(clean-extra) $(if $(level),,clean-subdirs)
- rm -rf pal_loader $(call expand_target,$(exec_target)) $(target)
- build-subdirs:
- for f in $(subdirs); do (cd $$f; $(MAKE); cd ..); done
- ifeq ($(SYS),x86_64-linux-gnu)
- ifeq ($(level),)
- .PHONY: pack
- pack:
- for f in $(subdirs); do (cd $$f; $(MAKE) pack; cd ..); done
- endif
- endif
- clean-subdirs:
- for f in $(subdirs); do (cd $$f; $(MAKE) clean; cd ..); done
|