Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. NPROCS := 1
  2. OS := $(shell uname -s)
  3. ifeq ($(OS),Linux)
  4. NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
  5. endif
  6. target = build-java $(patsubst %.java,%.class,$(wildcard classes/*.java))
  7. exec_target = java.manifest
  8. clean-extra = clean-classes
  9. ifeq ($(HUGE),)
  10. RESOURCE_RULE = sys.stack.size = 256K\nsys.brk.size = 16M\nglibc.heap_size = 4M\nsgx.enclave_size = 256M\nsgx.thread_num = 12
  11. else
  12. RESOURCE_RULE = sys.stack.size = 4M\nsys.brk.size = 64M\nglibc.heap_size = 16M\nsgx.enclave_size = 8G\nsgx.thread_num = 32
  13. endif
  14. extra_rules = \
  15. -e 's:\$$(DEBUGTYPE):$(if $(DEBUG),inline,none):g' \
  16. -e 's:\$$(JAVA_HOME):$(JAVA_HOME):g' \
  17. -e 's:\$$(RESOURCE_RULE):$(RESOURCE_RULE):g'
  18. level = ../../
  19. include ../../Makefile
  20. TEST_CLASS = $(patsubst %.java,%,$(wildcard classes/*.java))
  21. USE_UBUNTU_SRC = no
  22. VERSION = 7
  23. ICEDTEA_URL = http://icedtea.wildebeest.org/download/drops/icedtea7/2.6.4/
  24. JAVA_DIR = openjdk-7
  25. JAVA_SRC = $(JAVA_DIR) $(JAVA_DIR)/hotspot $(JAVA_DIR)/jdk $(JAVA_DIR)/jdk/src/share/lib/security/nss.cfg
  26. JAVA_HOME = openjdk-7-jre
  27. $(JAVA_DIR): openjdk.tar.bz2
  28. tar -xmjf $<
  29. rm -rf $@
  30. mv $(shell tar -tjf $< | sed -e 's@/.*@@' | head -n 1) $@
  31. $(JAVA_DIR)/hotspot: hotspot.tar.bz2 | $(JAVA_DIR)
  32. tar -xmjf $<
  33. rm -rf $@
  34. mv $(shell tar -tjf $< | sed -e 's@/.*@@' | head -n 1) $@
  35. $(JAVA_DIR)/jdk: jdk.tar.bz2 | $(JAVA_DIR)
  36. tar -xmjf $<
  37. rm -rf $@
  38. cd $(shell tar -tjf $< | sed -e 's@/.*@@' | head -n 1) && patch -p1 < ../JDK-8015880.patch
  39. mv $(shell tar -tjf $< | sed -e 's@/.*@@' | head -n 1) $@
  40. openjdk.tar.bz2 hotspot.tar.bz2 jdk.tar.bz2:
  41. wget $(ICEDTEA_URL)$@
  42. $(JAVA_DIR)/jdk/src/share/lib/security/nss.cfg: $(JAVA_DIR)/jdk/src/share/lib/security/nss.cfg.in | $(JAVA_DIR)/jdk
  43. sed 's:@NSS_LIBDIR@:/usr/lib/x86_64-linux-gnu:g' $< > $@
  44. HOST_JAVA_HOME=$(subst /jre/bin/java,,$(shell readlink -f $(shell which java)))
  45. INSTALL_DIR = $(JAVA_DIR)/build/linux-amd64
  46. JRE_DIR = $(INSTALL_DIR)/j2sdk-image/jre
  47. JDK_DIR = $(INSTALL_DIR)/j2sdk-image
  48. JAVAC = $(JDK_DIR)/bin/javac
  49. $(JRE_DIR)/bin/java $(JAVAC): $(JAVA_SRC)
  50. cd $(JAVA_DIR) && \
  51. make \
  52. ALT_BOOTDIR=$(HOST_JAVA_HOME) \
  53. ALT_JDK_IMPORT_PATH=$(HOST_JAVA_HOME) \
  54. ANT=/usr/bin/ant \
  55. INSANE="true" \
  56. FT2_CFLAGS=$(shell pkg-config --cflags freetype2) \
  57. FT2_LIBS=$(shell pkg-config --libs freetype2) \
  58. STATIC_CXX="false" \
  59. EXTRA_CFLAGS="-fPIC" \
  60. NO_DOCS="true" \
  61. BUILD_HEADLESS_ONLY="true" \
  62. BUILD_HOTSPOT="true" BUILD_JDK="true" \
  63. BUILD_LANGTOOLS="false" \
  64. BUILD_JAXP="false" BUILD_JAXWS="false" BUILD_CORBA="false" \
  65. HOTSPOT_BUILD_JOBS="$(NPROCS)" \
  66. TEST_IN_BUILD="false" \
  67. product_build
  68. $(JAVA_HOME)/bin/java: $(JRE_DIR)/bin/java
  69. rm -rf $(JAVA_HOME)
  70. cp -rf $(JRE_DIR) $(JAVA_HOME)
  71. find $(JAVA_HOME) -type f -executable -exec strip --strip-debug {} \;
  72. distclean: clean
  73. rm -rf $(JAVA_DIR) $(JAVA_HOME)
  74. build-java: $(JAVA_HOME)/bin/java $(JAVAC)
  75. java_home:
  76. @echo $(JAVA_HOME)
  77. %.class: %.java $(JAVAC)
  78. $(JAVAC) $<
  79. clean-classes:
  80. rm -f $(addsuffix .class,$(TEST_CLASS))