source: trunk/kBuild/tools/YASM.kmk

Last change on this file was 3520, checked in by bird, 4 years ago

NASM.kmk,YASM.kmk: Properly quote includes and defines.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
RevLine 
[419]1# $Id: YASM.kmk 3520 2021-12-18 13:39:52Z bird $
2## @file
3# kBuild Tool Config - YASM 0.4.0 or later.
4#
[1547]5
6#
[3121]7# Copyright (c) 2006-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
[419]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#
[1547]26# As a special exception you are granted permission to include this file, via
[2243]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.
[1547]29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
[419]33
[667]34TOOL_YASM := YASM v0.4.0+
[419]35
[667]36# Tool Specific Properties
[419]37ifndef PATH_TOOL_YASM
[2750]38 PATH_TOOL_YASM := $(sort $(wildcard $(KBUILD_DEVTOOLS_HST)/yasm/v*.*))
[667]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)
[419]45endif
46ifneq ($(PATH_TOOL_YASM),)
[667]47 TOOL_YASM_AS ?= $(PATH_TOOL_YASM)/yasm$(HOSTSUFF_EXE)
[419]48else
[667]49 TOOL_YASM_AS ?= yasm$(HOSTSUFF_EXE)
[419]50endif
51
[2873]52# kSubmit
53ifdef TOOL_YASM_USE_KSUBMIT
54 ifeq ($(KBUILD_HOST),win)
55 TOOL_YASM_KSUBMIT ?= kmk_builtin_kSubmit --
56 endif
57endif
58
[667]59# General Properties used by kBuild
60TOOL_YASM_ASFLAGS ?=
[419]61
[667]62
[419]63## Compile Assembly source.
64# @param $(target) Normalized main target name.
65# @param $(source) Source filename (relative).
66# @param $(obj) Object file name. This shall be (re)created by the compilation.
67# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
68# @param $(flags) Flags.
69# @param $(defs) Definitions. No -D or something.
70# @param $(incs) Includes. No -I or something.
71# @param $(dirdep) Directory creation dependency.
72# @param $(deps) Other dependencies.
73# @param $(outbase) Output basename (full). Use this for list files and such.
74# @param $(objsuff) Object suffix.
75#
[2692]76TOOL_YASM_COMPILE_AS_OUTPUT = $(outbase).lst
77TOOL_YASM_COMPILE_AS_OUTPUT_MAYBE = $(obj).map
[419]78TOOL_YASM_COMPILE_AS_DEPEND =
79TOOL_YASM_COMPILE_AS_DEPORD =
80define TOOL_YASM_COMPILE_AS_CMDS
[2891]81ifdef TOOL_YASM_KSUBMIT # yasm 1.3.0 w/ patches.
[2873]82 $(QUIET)$(TOOL_YASM_KSUBMIT) $(TOOL_YASM_AS)\
[2692]83 $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
[3520]84 $(addsuffix /,$(qaddprefix sh,-I, $(incs))) $(qaddprefix sh,-D, $(defs))\
85 -l $(outbase).lst \
86 -o $(obj) \
[2891]87 -MD="$(dep)" -MP --makedep-dos2unix-slash\
[697]88 $(abspath $(source))
[2891]89else
90 $(QUIET)$(TOOL_YASM_AS)\
91 $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
[3520]92 $(addsuffix /,$(qaddprefix sh,-I, $(incs))) $(qaddprefix sh,-D, $(defs))\
[2891]93 -l $(outbase).lst\
94 -o $(obj)\
95 $(abspath $(source))
[2686]96 $(QUIET)$(REDIRECT) -wo $(dep) -- $(TOOL_YASM_AS) -DKBUILD_GENERATING_MAKEFILE_DEPENDENCIES\
[2693]97 $(patsubst --mapfile%,--mapfile=$(obj).map,$(flags))\
[3520]98 $(addsuffix /,$(qaddprefix sh,-I, $(incs))) $(qaddprefix sh,-D, $(defs))\
99 -o $(obj)\
[1277]100 $(abspath $(source)) \
101 -M
[2690]102 if1of ($(KBUILD_HOST), win nt os2)
103 $(QUIET)$(SED) -e 's/\\\(.\)/\/\1/g' --output "$(dep).tmp" "$(dep)"
[2691]104 else
105 $(QUIET)$(CP) -f -- "$(dep)" "$(dep).tmp"
[2690]106 endif
[2691]107 $(QUIET)$(APPEND) -n "$(dep).tmp" "" ""
108 $(QUIET)$(SED) $(if $(intersects $(KBUILD_HOST), win nt os2), -e 's/\\\(.\)/\/\1/g',)\
109 -e 's/^[^ ]*: / /'\
110 -e 's/ *\\$$(DOLLAR)//'\
111 -e 's/^ *//'\
112 -e 's/ */\n/g'\
113 -e 's/ *\([^ \n][^ \n]*\)/\1:\n/g'\
114 --append "$(dep).tmp"\
115 "$(dep)"
116 $(QUIET)$(MV) -f -- "$(dep).tmp" "$(dep)"
[2891]117endif
[419]118endef
119
Note: See TracBrowser for help on using the repository browser.