1# 2# %CopyrightBegin% 3# 4# Copyright Ericsson AB 1996-2018. All Rights Reserved. 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# 18# %CopyrightEnd% 19# 20 21ifdef BOOTSTRAP_COMPILER 22EGEN=$(BOOTSTRAP_COMPILER)/egen 23EBIN=$(BOOTSTRAP_COMPILER)/ebin 24else 25ifdef BOOTSTRAP 26EGEN=$(BOOTSTRAP_TOP)/lib/compiler/egen 27EBIN=$(BOOTSTRAP_TOP)/lib/compiler/ebin 28endif 29endif 30 31include $(ERL_TOP)/make/target.mk 32include $(ERL_TOP)/make/$(TARGET)/otp.mk 33 34# ---------------------------------------------------- 35# Application version 36# ---------------------------------------------------- 37include ../vsn.mk 38VSN=$(COMPILER_VSN) 39 40# ---------------------------------------------------- 41# Release directory specification 42# ---------------------------------------------------- 43RELSYSDIR = $(RELEASE_PATH)/lib/compiler-$(VSN) 44 45# ---------------------------------------------------- 46# Target Specs 47# ---------------------------------------------------- 48MODULES = \ 49 beam_a \ 50 beam_asm \ 51 beam_block \ 52 beam_bs \ 53 beam_bsm \ 54 beam_clean \ 55 beam_dead \ 56 beam_dict \ 57 beam_disasm \ 58 beam_except \ 59 beam_flatten \ 60 beam_jump \ 61 beam_listing \ 62 beam_opcodes \ 63 beam_peep \ 64 beam_receive \ 65 beam_reorder \ 66 beam_record \ 67 beam_split \ 68 beam_trim \ 69 beam_type \ 70 beam_utils \ 71 beam_validator \ 72 beam_z \ 73 cerl \ 74 cerl_clauses \ 75 cerl_inline \ 76 cerl_sets \ 77 cerl_trees \ 78 compile \ 79 core_lib \ 80 core_lint \ 81 core_parse \ 82 core_pp \ 83 core_scan \ 84 erl_bifs \ 85 rec_env \ 86 sys_core_alias \ 87 sys_core_bsm \ 88 sys_core_dsetel \ 89 sys_core_fold \ 90 sys_core_fold_lists \ 91 sys_core_inline \ 92 sys_pre_attributes \ 93 v3_codegen \ 94 v3_core \ 95 v3_kernel \ 96 v3_kernel_pp 97 98BEAM_H = $(wildcard ../priv/beam_h/*.h) 99 100HRL_FILES= \ 101 beam_disasm.hrl \ 102 core_parse.hrl \ 103 v3_kernel.hrl 104 105YRL_FILE = core_parse.yrl 106 107EXTRA_FILES= $(EGEN)/beam_opcodes.hrl 108 109ERL_FILES= $(MODULES:%=%.erl) 110INSTALL_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET) 111TARGET_FILES= $(INSTALL_FILES) 112 113APP_FILE= compiler.app 114APP_SRC= $(APP_FILE).src 115APP_TARGET= $(EBIN)/$(APP_FILE) 116 117APPUP_FILE= compiler.appup 118APPUP_SRC= $(APPUP_FILE).src 119APPUP_TARGET= $(EBIN)/$(APPUP_FILE) 120 121# ---------------------------------------------------- 122# FLAGS 123# ---------------------------------------------------- 124 125ifeq ($(NATIVE_LIBS_ENABLED),yes) 126ERL_COMPILE_FLAGS += +native 127endif 128ERL_COMPILE_FLAGS += +inline +warn_unused_import \ 129 -Werror \ 130 -I../../stdlib/include -I$(EGEN) -W +warn_missing_spec 131 132# ---------------------------------------------------- 133# Targets 134# ---------------------------------------------------- 135 136debug opt: $(TARGET_FILES) 137 138docs: 139 140clean: 141 rm -f $(TARGET_FILES) 142 rm -f $(EGEN)/beam_opcodes.erl $(EGEN)/beam_opcodes.hrl 143 rm -f $(EGEN)/core_parse.erl 144 rm -f core 145 146# ---------------------------------------------------- 147# Special Build Targets 148# ---------------------------------------------------- 149 150$(APP_TARGET): $(APP_SRC) ../vsn.mk 151 $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ 152 153$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk 154 $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ 155 156$(EGEN)/beam_opcodes.erl $(EGEN)/beam_opcodes.hrl: genop.tab 157 $(gen_verbose)$(PERL) $(ERL_TOP)/erts/emulator/utils/beam_makeops -compiler -outdir $(EGEN) $< 158 159$(EBIN)/beam_asm.beam: $(ESRC)/beam_asm.erl $(EGEN)/beam_opcodes.hrl 160 $(V_ERLC) $(ERL_COMPILE_FLAGS) -DCOMPILER_VSN='"$(VSN)"' -o$(EBIN) $< 161 162$(EBIN)/cerl_inline.beam: $(ESRC)/cerl_inline.erl 163 $(V_ERLC) $(ERL_COMPILE_FLAGS) +nowarn_shadow_vars -o$(EBIN) $< 164 165# Inlining core_parse is slow and has no benefit. 166$(EBIN)/core_parse.beam: $(EGEN)/core_parse.erl 167 $(V_ERLC) $(subst +inline,,$(ERL_COMPILE_FLAGS)) -o$(EBIN) $< 168 169# ---------------------------------------------------- 170# Release Target 171# ---------------------------------------------------- 172include $(ERL_TOP)/make/otp_release_targets.mk 173 174release_spec: opt 175 $(INSTALL_DIR) "$(RELSYSDIR)/src" 176 $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(EXTRA_FILES) \ 177 $(YRL_FILE) "$(RELSYSDIR)/src" 178 $(INSTALL_DIR) "$(RELSYSDIR)/ebin" 179 $(INSTALL_DATA) $(INSTALL_FILES) "$(RELSYSDIR)/ebin" 180 181release_docs_spec: 182 183# ---------------------------------------------------- 184# Dependencies -- alphabetically, please 185# ---------------------------------------------------- 186 187$(EBIN)/beam_disasm.beam: $(EGEN)/beam_opcodes.hrl beam_disasm.hrl 188$(EBIN)/beam_listing.beam: core_parse.hrl v3_kernel.hrl 189$(EBIN)/cerl.beam: core_parse.hrl 190$(EBIN)/compile.beam: core_parse.hrl ../../stdlib/include/erl_compile.hrl 191$(EBIN)/core_lib.beam: core_parse.hrl 192$(EBIN)/core_lint.beam: core_parse.hrl 193$(EBIN)/core_parse.beam: core_parse.hrl $(EGEN)/core_parse.erl 194$(EBIN)/core_pp.beam: core_parse.hrl 195$(EBIN)/sys_core_alias.beam: core_parse.hrl 196$(EBIN)/sys_core_dsetel.beam: core_parse.hrl 197$(EBIN)/sys_core_fold.beam: core_parse.hrl 198$(EBIN)/sys_core_fold_lists.beam: core_parse.hrl 199$(EBIN)/sys_core_inline.beam: core_parse.hrl 200$(EBIN)/v3_codegen.beam: v3_kernel.hrl 201$(EBIN)/v3_core.beam: core_parse.hrl 202$(EBIN)/v3_kernel.beam: core_parse.hrl v3_kernel.hrl 203$(EBIN)/v3_kernel_pp.beam: v3_kernel.hrl 204