⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mkmacros.tpl

📁 VRTX 商用嵌入式实时操作系统
💻 TPL
字号:
@dnl -------------------------------------------------------------------------
@dnl
@dnl            Copyright (c) 1995 MICROTEC RESEARCH INC.
@dnl
@dnl    All rights reserved. MICROTEC's source code is an unpublished
@dnl    work and the use of a copyright notice does not imply otherwise.
@dnl    This source code contains confidential, trade secret material of
@dnl    MICROTEC. Any attempt or participation in deciphering, decoding,
@dnl    reverse engineering or in any way altering the source code is
@dnl    strictly prohibited, unless the prior written consent of
@dnl    MICROTEC is obtained.
@dnl
@dnl
@dnl    Module Name:            mkmacros.tpl
@dnl
@dnl    Identification:         @(#) 1.30 mkmacros.tpl
@dnl
@dnl    Date:                   11/7/94  17:33:05
@dnl
@dnl -------------------------------------------------------------------------
@dnl
@dnl    macro:  nshift
@dnl    usage:  @nshift(n,list)
@dnl    description:    shifts "list" to the left by "n"
@dnl
@define(nshift,`@ifelse($1,0,`@shift($@)',`@nshift(@decr($1),@shift(@shift($@)))')')@dnl
@dnl
@dnl    macro:  make_list
@dnl    usage:  @make_list(prefix,suffix,separator,list)
@dnl    description:    creates a list of elements of the form
@dnl            "prefix"ELMT"suffix" for every ELMT in "list". All
@dnl            elements are separated by "separator"
@dnl
@define(make_list,`@ifelse($#$4,4,,`$1$4$2'`@ifelse($#,4,,`@ifelse($#$5,5,,`$3')')@make_list(`$1',`$2',`$3',@nshift(4,$@))')')@dnl
@dnl 
@dnl This explains how the general mechanism to build makefiles works.
@dnl Ruls that have to go into the makefile are identified by the type of
@dnl the rule (for example link) and information about the specific rule (for
@dnl example the file that has to be generated, the dependencies, etc.)
@dnl Let us assume that we want to generate a rule for "link" and "boot".
@dnl We must provide the following xconfig variables:
@dnl - make.link.boot.name:     this is a root that can be used to form strings
@dnl - make.link.boot.target:   the makefile target associated with this rule
@dnl - make.link.boot.deps:   list of dependencies we want xconfig to take care of
@dnl - make.link.boot.pp.rule:  rule that we must use to generate the rule for 
@dnl   dependency pp (pp must be in @(make.link.boot.deps))
@dnl - Any other rule specific information, always using the prefix
@dnl make.link.boot.
@dnl We must also provide the macro make_link that actually generates the
@dnl make rule with target @(make.link.boot.target)
@dnl
@dnl    macro:  make_target_recursive
@dnl    usage:  @make_target_recursive(rule,what)
@dnl    description:    recursively generates targets
@dnl
@define(make_target_recursive,`@make_$1($2)
@make_deps_recursive($1,$2)
')@dnl
@dnl    
@dnl    macro:  make_deps_recursive
@dnl    usage:  @make_deps_recursive(rule,what)
@dnl    description:    recursively generates target for dependencies
@dnl
@define(make_deps_recursive_tmp,`@ifelse($3,,,`@make_@(make.$1.$2.$3.rule)($3)
@make_deps_recursive_tmp($1,$2,@nshift(3,$@))
@make_deps_recursive(@(make.$1.$2.$3.rule),$3)
')')@dnl
@define(make_deps_recursive,`@make_deps_recursive_tmp($1,$2,@(make.$1.$2.deps))')@dnl
@dnl
@dnl    macro:  make_dep_list
@dnl    usage:  @make_dep_list(rule,what)
@dnl    description:    creates the list of dependencies of make.rule.what to be
@dnl            used in makefile
@dnl
@define(make_dep_list_tmp,`@ifelse($3,,,`@(make.@(make.$1.$2.$3.rule).$3.target) @make_dep_list_tmp($1,$2,@nshift(3,$@))')')@dnl
@define(make_dep_list,`@make_dep_list_tmp($1,$2,@(make.$1.$2.deps))')@dnl
@dnl
@dnl    macro:  make_link
@dnl    usage:  @make_link(what, how)
@dnl    description:    common macro used by all macroes in the @make_link_*
@dnl            family.
@dnl            It expects the following xconfig variables to exist:
@dnl            make.link_how.what.name - the name used to build the target
@dnl            make.link_how.what.target: - the makefile target
@dnl            make.link_how.what.objs - list of objects to link
@dnl            make.link_how.what.libs - list of libraries to link
@dnl            It also expects the following macroes to be available (they are
@dnl            typically generated by a tool dependent .def or .tpl file):
@dnl            @tool_make_vars(var,depvar,list)
@dnl                    creates make variables "var" and "depvar". "var" can
@dnl                    be uses in command lines as argument to the linker,
@dnl                    "depvar" is used for dependencies.
@dnl            @tool_make_how(output,objs,libs,objdeps,libdeps,code,data,target,
@dnl                            map,unreslist)
@dnl                    "output","objs","objdeps","libs" and"libdeps" are
@dnl                    make variables that are used to generate the rules.
@dnl                    "code" and "data" are hex numbers.
@dnl                    "target" is the first target.
@dnl                    "map" is a mapfile to use to resolve symbols
@dnl                    "unreslist" is a list of symbols to resolve from map
@dnl            The following two variables should also be supported by all
@dnl            tools. They are currently supported only by pharlap.
@dnl            make.link_how.what.unres.list:  list of unresolved symbols
@dnl            make.link_how.what.unres.map:   map file to resolve these symbols
@dnl
@define(make_link,`
@tool_make_vars($1_LIBS,LIBS_DEPEND,@(make.link_$2.$1.libs))

@tool_make_vars($1_OBJS,OBJS_DEPEND,@(make.link_$2.$1.objs))

@ifelse(@(make.link_$2.$1.unres.map),,`
@dnl 11th and 12th arguments ($1 and $2) are passed to allow tools direct
@dnl access to make.link_$2.$1.libs and make.link_$2.$1.libs. They are used
@dnl microtec.def to create linker script files with objects and libraries to
@dnl load.
@tool_make_$2(`@(make.link_$2.$1.name)',`$($1_OBJS)',`$($1_LIBS)',`$(OBJS_DEPEND)',`$(LIBS_DEPEND)',@(make.link_$2.$1.code),@(make.link_$2.$1.data),@(make.link_$2.$1.target),,,$1,$2)
',`
# $1_UNRESMAP is a map file
# $1_UNRESLIST is a list of symbols to resolve from file $($1_UNRESMAP)
@dnl
$1_UNRESMAP = @(make.link_$2.$1.unres.map)
$1_UNRESLIST = @make_list(,,`` '',@(make.link_$2.$1.unres.list))
@dnl
@dnl 11th and 12th arguments ($1 and $2) are passed to allow tools direct
@dnl access to make.link_$2.$1.libs and make.link_$2.$1.libs. They are used
@dnl microtec.def to create linker script files with objects and libraries to
@dnl load.
@tool_make_$2(`@(make.link_$2.$1.name)',`$($1_OBJS)',`$($1_LIBS)',`$(OBJS_DEPEND)',`$(LIBS_DEPEND)',@(make.link_$2.$1.code),@(make.link_$2.$1.data),@(make.link_$2.$1.target),`$($1_UNRESMAP)',`$($1_UNRESLIST)',$1,$2)
')@dnl
')@dnl
@dnl
@dnl    macro:  make_link_rel
@dnl    usage:  @make_link_rel(what)
@dnl    description:    creates rules and variables to link some objects and
@dnl            libraries into a relocatable object.
@dnl            See also @make_link.
@dnl
@define(make_link_rel,`@make_link($1,rel)')@dnl
@dnl
@dnl    macro:  make_link_abs
@dnl    usage:  @make_link_abs(what)
@dnl    description:    creates rules and variables to link some objects and
@dnl            libraries into an absolute host object (e.g. virtual target).
@dnl            See also @make_link.
@dnl
@define(make_link_abs,`@make_link($1,abs)')@dnl
@dnl
@dnl    macro:  make_link_hex
@dnl    usage:  @make_link_hex(what)
@dnl    description:    creates rules and variables to link some objects and
@dnl            libraries into a motorola hex object.
@dnl            See also @make_link.
@dnl            In addition to the variables defined in @make_link also the
@dnl            following variables are expected
@dnl            make.link_hex.what.code - start address of code
@dnl            make.link_hex.what.data - start address of data
@dnl
@define(make_link_hex,`@make_link($1,hex)')@dnl
@dnl
@dnl    macro:  make_cathex
@dnl    usage:  @make_cathex(list)
@dnl    description:
@dnl
@define(make_cathex,`@(make.cathex.$1.target): @make_dep_list(cathex,$1)
	cathex @make_dep_list(cathex,$1) >@(make.cathex.$1.target)
')@dnl
@dnl
@dnl    macro:  make_independent
@dnl    usage:  @make_independent(list)
@dnl    description:    creates a rule to make several things independently
@dnl
@define(make_independent,`@(make.independent.$1.target): @make_dep_list(independent,$1)
')@dnl
@dnl
@dnl    macro:  make_sutil
@dnl    usage:  @make_sutil(what)
@dnl    description:
@dnl    It assumes the following are available:
@dnl    make.sutil.what.code
@dnl    make.sutil.what.data
@dnl
@dnl @define(make_sutil,`@(make.sutil.$1.target): @make_dep_list(sutil,$1)
@dnl    sutil -S 3 -r -@(make.sutil.$1.code) @make_dep_list(sutil,$1) >@(make.sutil.$1.target)
@dnl ')@dnl

@dnl
@dnl    macro:  make_omf2hex
@dnl    usage:  @make_omf2hex(what)
@dnl    description:
@dnl    It assumes the following are available:
@dnl    make.omf2hex.what.code
@dnl    make.omf2hex.what.data
@dnl
@define(make_omf2hex,`@ifelse(@(make.boot.pc),yes,,
	`@(make.omf2hex.$1.target): @make_dep_list(omf2hex,$1) 
	omf2hex @make_dep_list(omf2hex,$1) > @(make.omf2hex.$1.target)')')@dnl
@dnl
@dnl
@dnl    macro:  make_map2s
@dnl    usage:  @make_map2s(what)
@dnl    description: Creates an assembly file that declares all references
@dnl            contained in a map file. It calls the tool dependent macro
@dnl            @tool_make_map2s.
@dnl            It assumes the following exists:
@dnl            make.map2s.what.mapfile
@define(make_map2s,`@tool_make_map2s(@(make.map2s.$1.target),@(make.map2s.$1.mapfile))')@dnl
@dnl
@dnl    macro:  make_copy
@dnl    usage:  @make_copy(what)
@dnl    description: If @(make.copy.what.target) is older than
@dnl            @(make.copy.what.from)
@dnl            then it copies the latter into the former.
@dnl            It assumes the following exists:
@dnl            make.copy.what.target
@dnl            make.copy.what.from
@define(make_copy,`@(make.copy.$1.target):      @make_path(@(make.copy.$1.from))
	copy @make_path(@(make.copy.$1.from)) $`'@
')@dnl
@dnl
@dnl    macro: make_path
@dnl    usage: @make_path(path with slash or backslash)
@dnl    description: Expands into a path appropriate for the host system.
@define(make_path,@ifdef(unix,``@translit(`$@',/\,//)'')@ifdef(dos,``@translit(`$@',/\,\\)''))@dnl
@dnl
@dnl    macro: list_count
@dnl    usage: @list_count(list of elements separated by commas)
@dnl    description: Expands into the argument count; i.e. list size. 
@dnl            For example, @list_count(a,b,c,d) expands into 4.
@define(list_count,`$#')@dnl
@dnl
@dnl    macro: nth
@dnl    usage: @nth(list of elements separated by commas)
@dnl    description: Expands into the nth argument. For example, 
@dnl            @nth(2,a,b,c,d) expands into b.
@define(nth,`@ifelse($1,1,`$2',`@nth(@decr('$1`),@shift(@shift($@)))')')
@dnl
@dnl    macro: remove_empty
@dnl    usage: @remove_empty(list of elements separated by commas)
@dnl    description: Expands into the list of its arguments with the empty
@dnl            arguments removed.
@dnl version 1
@dnl @define(remove_empty_helper,`@ifelse($2,,,`@ifelse($1,1,`,')$2')@ifelse($#,2,,`@remove_empty_helper(@ifelse($2,,$1,1),@shift(@shift($@)))')')@dnl
@dnl @define(remove_empty,`@remove_empty_helper(0,$@)')@dnl
@dnl version 2
@define(rmempty_aux,`@ifelse($#,1,`@ifelse($1,,,`,$1')',`@ifelse($1,,`@rmempty_aux(@shift($@))',`,$1@rmempty_aux(@shift($@))')')')@dnl
@define(remove_empty,`@ifelse($#,1,`$1',`@ifelse($1,,`@remove_empty(@shift($@))',`$1@rmempty_aux(@shift($@))')')')@dnl

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -