source: trunk/kBuild/tools/YASM.kmk@ 2692

Last change on this file since 2692 was 2692, checked in by bird, 12 years ago

Not quite as simple. Only bin and dosexe formats supports map files. Leave it to the user by replacing all attempts at using --mapfile.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1# $Id: YASM.kmk 2692 2013-07-22 13:31:00Z bird $
2## @file
3# kBuild Tool Config - YASM 0.4.0 or later.
4#
5
6#
7# Copyright (c) 2006-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26# As a special exception you are granted permission to include this file, via
27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34TOOL_YASM := YASM v0.4.0+
35
36# Tool Specific Properties
37ifndef PATH_TOOL_YASM
38 PATH_TOOL_YASM := $(sort $(wildcard $(PATH_DEVTOOLS_BLD)/yasm/v*.*))
39 ifneq ($(PATH_TOOL_YASM),)
40 PATH_TOOL_YASM := $(call lastword,$(PATH_TOOL_YASM))
41 endif
42else
43 # Resolve any fancy stuff once and for all.
44 PATH_TOOL_YASM := $(PATH_TOOL_YASM)
45endif
46ifneq ($(PATH_TOOL_YASM),)
47 TOOL_YASM_AS ?= $(PATH_TOOL_YASM)/yasm$(HOSTSUFF_EXE)
48else
49 TOOL_YASM_AS ?= yasm$(HOSTSUFF_EXE)
50endif
51
52# General Properties used by kBuild
53TOOL_YASM_ASFLAGS ?=
54
55
56## Compile Assembly source.
57# @param $(target) Normalized main target name.
58# @param $(source) Source filename (relative).
59# @param $(obj) Object file name. This shall be (re)created by the compilation.
60# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
61# @param $(flags) Flags.
62# @param $(defs) Definitions. No -D or something.
63# @param $(incs) Includes. No -I or something.
64# @param $(dirdep) Directory creation dependency.
65# @param $(deps) Other dependencies.
66# @param $(outbase) Output basename (full). Use this for list files and such.
67# @param $(objsuff) Object suffix.
68#
69TOOL_YASM_COMPILE_AS_OUTPUT = $(outbase).lst
70TOOL_YASM_COMPILE_AS_OUTPUT_MAYBE = $(obj).map
71TOOL_YASM_COMPILE_AS_DEPEND =
72TOOL_YASM_COMPILE_AS_DEPORD =
73define TOOL_YASM_COMPILE_AS_CMDS
74 $(QUIET)$(TOOL_YASM_AS)\
75 $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
76 $(addsuffix /,$(addprefix -I, $(incs))) $(addprefix -D, $(defs))\
77 -l $(outbase).lst\
78 -o $(obj)\
79 $(abspath $(source))
80 $(QUIET)$(REDIRECT) -wo $(dep) -- $(TOOL_YASM_AS) -DKBUILD_GENERATING_MAKEFILE_DEPENDENCIES\
81 $(flags) $(addsuffix /,$(addprefix -I, $(incs))) $(addprefix -D, $(defs))\
82 -o $(obj) \
83 $(abspath $(source)) \
84 -M
85 if1of ($(KBUILD_HOST), win nt os2)
86 $(QUIET)$(SED) -e 's/\\\(.\)/\/\1/g' --output "$(dep).tmp" "$(dep)"
87 else
88 $(QUIET)$(CP) -f -- "$(dep)" "$(dep).tmp"
89 endif
90 $(QUIET)$(APPEND) -n "$(dep).tmp" "" ""
91 $(QUIET)$(SED) $(if $(intersects $(KBUILD_HOST), win nt os2), -e 's/\\\(.\)/\/\1/g',)\
92 -e 's/^[^ ]*: / /'\
93 -e 's/ *\\$$(DOLLAR)//'\
94 -e 's/^ *//'\
95 -e 's/ */\n/g'\
96 -e 's/ *\([^ \n][^ \n]*\)/\1:\n/g'\
97 --append "$(dep).tmp"\
98 "$(dep)"
99 $(QUIET)$(MV) -f -- "$(dep).tmp" "$(dep)"
100endef
101
Note: See TracBrowser for help on using the repository browser.