aboutsummaryrefslogblamecommitdiffstats
path: root/make/ose_lm.mk.in
blob: de8d351af322981d991b9dfb686f5b8ec755e778 (plain) (tree)
1
2
3
4
5
6
7
8







                                                      


                                                                  
 






                                                                          




















                                                      


                                                



                                           

                                      


























                                                                                  
#-*-makefile-*-   ; force emacs to enter makefile-mode
# ----------------------------------------------------
# Template target for generating an OSE5 load module
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2013. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# %CopyrightEnd%
#
# Author: Petre Pircalabu
# ----------------------------------------------------

# ----------------------------------------------------
# 	build-ose-load-module
#	Creates an OSE5 load module
#	params:
#		$(1) - The output target
#		$(2) - Objects
#		$(3) - Libraries
#		$(4) - LM configuration file
# ----------------------------------------------------

ifeq ($(findstring ose,$(TARGET)),ose)
LDR1FLAGS    = @erl_xcomp_ose_ldflags_pass1@
LDR2FLAGS    = @erl_xcomp_ose_ldflags_pass2@
OSEROOT	     = @erl_xcomp_ose_OSEROOT@
LCF	     = @erl_xcomp_ose_LM_LCF@
BEAM_LMCONF  = @erl_xcomp_ose_BEAM_LM_CONF@
EPMD_LMCONF  = @erl_xcomp_ose_EPMD_LM_CONF@
RUN_ERL_LMCONF = @erl_xcomp_ose_RUN_ERL_LM_CONF@
STRIP	     = @erl_xcomp_ose_STRIP@
LM_POST_LINK = @erl_xcomp_ose_LM_POST_LINK@
LM_SET_CONF  = @erl_xcomp_ose_LM_SET_CONF@
LM_ELF_SIZE  = @erl_xcomp_ose_LM_ELF_SIZE@
OSE_CONFD    = @erl_xcomp_ose_CONFD@
CRT0_LM      = @erl_xcomp_ose_CRT0_LM@
endif

define build-ose-load-module
	@echo " --- Linking $(1)"

	@echo " --- Linking $(1) (pass 1)"
	$(ld_verbose)$(PURIFY) $(LD) -o $(1)_unconfigured_ro -r \
	$(2) --start-group $(3) --end-group --cref --discard-none -M >  $(1)_1.map

	@echo " --- Linking $(1) (pass 2)"
	$(ld_verbose)$(PURIFY) $(LD) -o $(1)_unconfigured \
	$(1)_unconfigured_ro -T $(LCF) -n --emit-relocs -e crt0_lm --cref \
	--discard-none -M >  $(1)_2.map

	@echo " --- Inserting configuration"
	$(ld_verbose) $(LM_SET_CONF) $(1)_unconfigured < $(4)

	@echo " --- Striping $(1)"
#	$(ld_verbose) $(STRIP) $(1)_unconfigured

	@echo " --- Postlinking $(1)"
	$(ld_verbose) $(LM_POST_LINK) $(1)_unconfigured

	@echo " --- Sizing $(1)"
	$(ld_verbose) $(LM_ELF_SIZE) $(1)_unconfigured
	mv $(1)_unconfigured $(1)
endef