Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. SYS ?= $(shell gcc -dumpmachine)
  2. CC = gcc -g
  3. CFLAGS = -Wall -O2 -std=gnu99 -fgnu89-inline -fno-builtin -nostdlib \
  4. -I../include/pal -I../lib
  5. preloads = $(patsubst %.c,%,$(wildcard *.so.c))
  6. executables = $(filter-out $(preloads),$(patsubst %.c,%,$(wildcard *.c)))
  7. manifests = manifest $(patsubst %.manifest.template,%.manifest,$(wildcard *.manifest.template))
  8. target = $(executables) $(preloads) $(manifests)
  9. graphene_lib = .lib/graphene-lib.a
  10. pal_lib = ../src/libpal.so
  11. headers = $(wildcard ../include/pal/*.h)
  12. include ../src/Makefile.Test
  13. all: $(call expand_target,$(target))
  14. manifest_rules = \
  15. -e 's:\$$(PAL):$(abspath ../src/pal):g' \
  16. -e 's:\$$(PWD):$(shell pwd)/:g' \
  17. $(extra_rules)
  18. manifest: manifest.template
  19. rm -f $@
  20. sed $(manifest_rules) $< >$@
  21. chmod +x $@
  22. %.manifest: %.manifest.template
  23. rm -f $@
  24. sed $(manifest_rules) $< >$@
  25. chmod +x $@
  26. ../src/user_shared_start.o ../src/user_start.o: ../src/user_start.S
  27. $(MAKE) -C ../src $(notdir $@)
  28. ifeq ($(SYS),x86_64-linux-gnu)
  29. $(preloads): %.so: %.so.c ../src/user_shared_start.o \
  30. $(graphene_lib) $(pal_lib) ../include/pal/pal.h
  31. @echo [ $@ ]
  32. @$(CC) -shared -fPIC $(CFLAGS) $^ -o $@
  33. $(executables): %: %.c ../src/user_start.o \
  34. $(graphene_lib) $(pal_lib) $(preloads) ../include/pal/pal.h
  35. @echo [ $@ ]
  36. @$(CC) $(CFLAGS) $^ -o $@
  37. $(graphene_lib):
  38. $(MAKE) -C ../lib target=$(shell pwd)/.lib/ $(debug)
  39. .PHONY: pack
  40. pack: $(preloads) $(executables)
  41. @../../Scripts/pack_binaries.sh test $^
  42. else
  43. $(preloads) $(executables): .packed/test.tar.gz
  44. tar -xmozf $< $@
  45. endif
  46. PYTHONENV = "PYTHONPATH=../../Scripts"
  47. regression: $(call expand_target,$(target))
  48. @printf "\n\nBasic Bootstrapping:\n"
  49. @for f in $(wildcard 00_*.py); do env $(PYTHONENV) python $$f; done
  50. @printf "\n\nException Handling:\n"
  51. @for f in $(wildcard 01_*.py); do env $(PYTHONENV) python $$f; done
  52. @printf "\n\nSingle-Process Functionalities:\n"
  53. @for f in $(wildcard 02_*.py); do env $(PYTHONENV) python $$f; done
  54. @printf "\n\nProcess Creation:\n"
  55. @for f in $(wildcard 03_*.py); do env $(PYTHONENV) python $$f; done
  56. @printf "\n\nMulti-Process Functionalities:\n"
  57. @for f in $(wildcard 04_*.py); do env $(PYTHONENV) python $$f; done
  58. @printf "\n\nReference Monitor (Optional):\n"
  59. @for f in $(wildcard 05_*.py); do env $(PYTHONENV) python $$f; done
  60. @printf "\n\n"
  61. clean:
  62. rm -rf $(call expand_target,$(target)) *.tmp .lib