diff --git a/.gn b/.gn index 711391c18b56e9bdf8cfab4b951c3ff3f630f411..c00e581063d8ce84c72d56d979a105c8d833a701 100644 --- a/.gn +++ b/.gn @@ -1,15 +1,15 @@ # # Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. # -# OpenArkCompiler is licensed under the Mulan PSL v1. -# You can use this software according to the terms and conditions of the Mulan PSL v1. -# You may obtain a copy of Mulan PSL v1 at: +# OpenArkCompiler is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: # -# http://license.coscl.org.cn/MulanPSL +# http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR # FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v1 for more details. +# See the Mulan PSL v2 for more details. # buildconfig = "//build/config/BUILDCONFIG.gn" diff --git a/BUILD.gn b/BUILD.gn index 479351f76b44c8b7ef2dd8263cab403b5ea26e11..d593fd77180243483dcbd657447903518149bb9c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,16 +1,16 @@ # # Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. # -# OpenArkCompiler is licensed under the Mulan PSL v1. -# You can use this software according to the terms and conditions of the Mulan PSL v1. -# You may obtain a copy of Mulan PSL v1 at: +# OpenArkCompiler is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: # -# http://license.coscl.org.cn/MulanPSL +# http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR # FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v1 for more details. +# See the Mulan PSL v2 for more details. # group("maple") { deps = [ @@ -36,6 +36,12 @@ group("mplfeUT") { ] } +group("maple-rt") { + deps = [ + "${MAPLE_MRT_ROOT}:maple-rt", + ] +} + group("ast2mpl") { deps = [] if (IS_AST2MPL_EXISTS == "1") { @@ -64,7 +70,7 @@ group("maplegendef") { root_build_dir), rebase_path("${MAPLEALL_ROOT}/maple_be/include/ad/cortex_a55", root_build_dir), - rebase_path("${MAPLEALL_ROOT}/maple_be/include/ad/target", + rebase_path("${MAPLE_ROOT}/output/common/target", root_build_dir), ]) } diff --git a/Makefile b/Makefile index 91a46364e3e4ab75d98cfc7bae82571b5de036a1..a96264b03d4324bbfb03597881ade7c7f659154f 100644 --- a/Makefile +++ b/Makefile @@ -1,78 +1,122 @@ # -# Makefile for OpenArkCompiler -# # Copyright (c) [2020] Huawei Technologies Co.,Ltd.All rights reserved. # -# OpenArkCompiler is licensed under the Mulan PSL v1. -# You can use this software according to the terms and conditions of the Mulan PSL v1. -# You may obtain a copy of Mulan PSL v1 at: +# OpenArkCompiler is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: # -# http://license.coscl.org.cn/MulanPSL +# http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR # FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v1 for more details. +# See the Mulan PSL v2 for more details. # - -INSTALL_DIR := ${MAPLE_ROOT}/output -BUILD_TYPE := RELEASE +# Makefile for OpenArkCompiler +OPT := O2 +DEBUG := 0 +OPS_ANDROID := 0 +INSTALL_DIR := $(MAPLE_ROOT)/output +MAPLE_BIN_DIR := $(MAPLE_ROOT)/src/mapleall/bin +MRT_ROOT := $(MAPLE_ROOT)/src/mrt +ifeq ($(DEBUG),0) + BUILD_TYPE := RELEASE +else + BUILD_TYPE := DEBUG +endif HOST_ARCH := 64 MIR_JAVA := 1 -GN := ${MAPLE_ROOT}/tools/gn/gn -NINJA := ${MAPLE_ROOT}/tools/ninja_1.9.0/ninja +GN := $(MAPLE_ROOT)/tools/gn/gn +NINJA := $(MAPLE_ROOT)/tools/ninja_1.10.0/ninja GN_OPTIONS := \ GN_INSTALL_PREFIX="$(MAPLE_ROOT)" \ GN_BUILD_TYPE="$(BUILD_TYPE)" \ HOST_ARCH=$(HOST_ARCH) \ - MIR_JAVA=$(MIR_JAVA) + MIR_JAVA=$(MIR_JAVA) \ + OPT="$(OPT)" \ + OPS_ANDROID=$(OPS_ANDROID) .PHONY: default default: install .PHONY: maplegen maplegen: - $(call build_gn, ${GN_OPTIONS}, maplegen) + $(call build_gn, $(GN_OPTIONS), maplegen) .PHONY: maplegendef maplegendef: maplegen - $(call build_gn, ${GN_OPTIONS}, aarch64isa_headers maplegendef) + $(call build_gn, $(GN_OPTIONS), aarch64isa_headers maplegendef) .PHONY: maple maple: maplegendef - $(call build_gn, ${GN_OPTIONS}, maple) + $(call build_gn, $(GN_OPTIONS), maple) .PHONY: irbuild irbuild: - $(call build_gn, ${GN_OPTIONS}, irbuild) + $(call build_gn, $(GN_OPTIONS), irbuild) .PHONY: ast2mpl ast2mpl: - $(call build_gn, ${GN_OPTIONS}, ast2mpl) + $(call build_gn, $(GN_OPTIONS), ast2mpl) .PHONY: mplfe mplfe: - $(call build_gn, ${GN_OPTIONS}, mplfe) + $(call build_gn, $(GN_OPTIONS), mplfe) .PHONY: mplfeUT mplfeUT: - $(call build_gn, ${GN_OPTIONS} COV_CHECK=1, mplfeUT) + $(call build_gn, $(GN_OPTIONS) COV_CHECK=1, mplfeUT) + +.PHONY: maple-rt +maple-rt: java-core-def + $(call build_gn, $(GN_OPTIONS), maple-rt) + +.PHONY: libcore +libcore: install maple-rt + cd $(MAPLE_ROOT)/libjava-core; \ + $(MAKE) install OPT=$(OPT) DEBUG=$(DEBUG) OPS_ANDROID=$(OPS_ANDROID) + +.PHONY: java-core-def +java-core-def: install + cd $(MAPLE_ROOT)/libjava-core; \ + ln -f -s $(MAPLE_ROOT)/build/core/libcore.mk ./makefile; \ + $(MAKE) gen-def OPT=$(OPT) DEBUG=$(DEBUG) OPS_ANDROID=$(OPS_ANDROID) .PHONY: install -install: maple - $(shell mkdir -p $(MAPLE_ROOT)/output/ops/linker/; \ - cp -rf $(MAPLE_ROOT)/build/maplelld.so.lds $(MAPLE_ROOT)/output/ops/linker/; \ - cp -rf $(MAPLE_ROOT)/src/mapleall/bin/java2jar $(MAPLE_ROOT)/output/bin/; \ - cp -rf $(MAPLE_ROOT)/src/mapleall/bin/jbc2mpl $(MAPLE_ROOT)/output/bin/) +install: maple dex2mpl_install + $(shell mkdir -p $(INSTALL_DIR)/ops/linker/; \ + rsync -a -L $(MRT_ROOT)/maplert/linker/maplelld.so.lds $(INSTALL_DIR)/ops/linker/; \ + rsync -a -L $(MAPLE_ROOT)/build/java2d8 $(INSTALL_DIR)/bin; \ + rsync -a -L $(MAPLE_BIN_DIR)/java2jar $(INSTALL_DIR)/bin/; \ + rsync -a -L $(MAPLE_BIN_DIR)/jbc2mpl $(INSTALL_DIR)/bin/;) + +ifeq ($(OPS_ANDROID),0) +.PHONY: dex2mpl_install +dex2mpl_install: + $(shell rsync -a -L $(MAPLE_BIN_DIR)/dex2mpl $(INSTALL_DIR)/bin/;) +else +.PHONY: dex2mpl_install +dex2mpl_install: + $(shell rsync -a -L $(MAPLE_BIN_DIR)/dex2mpl_android $(INSTALL_DIR)/bin/dex2mpl;) +endif .PHONY: clean clean: @rm -rf output/ + @rm -f libjava-core/libcore-all.* + @rm -f libjava-core/*.mpl + @rm -f libjava-core/*.mplt + @rm -f libjava-core/*.groots.txt + @rm -f libjava-core/*.primordials.txt + @rm -rf libjava-core/comb.log + @rm -rf libjava-core/*.muid + @rm -f libjava-core/*.s + @rm -rf libjava-core/*.o define build_gn - mkdir -p ${INSTALL_DIR}; \ - $(GN) gen ${INSTALL_DIR} --args='$(1)' --export-compile-commands; \ - cd ${INSTALL_DIR}; \ + mkdir -p $(INSTALL_DIR); \ + $(GN) gen $(INSTALL_DIR) --args='$(1)' --export-compile-commands; \ + cd $(INSTALL_DIR); \ $(NINJA) -v $(2); endef