source: trunk/kBuild/tools/NASM.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: 3.2 KB
RevLine 
[95]1# $Id: NASM.kmk 3520 2021-12-18 13:39:52Z bird $
2## @file
[667]3# kBuild Tool Config - Netwide Assembler v0.98+.
[95]4#
[1547]5
6#
[3121]7# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
[95]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#
[95]33
[667]34TOOL_NASM := Netwide Assembler v0.98+
[95]35
[667]36# Tool Specific Properties
[95]37ifndef PATH_TOOL_NASM
[2808]38 PATH_TOOL_NASM := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
39 if "$(PATH_TOOL_NASM)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
40 PATH_TOOL_NASM := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
[655]41 endif
[667]42else
43 # Resolve any fancy stuff once and for all.
44 PATH_TOOL_NASM := $(PATH_TOOL_NASM)
[95]45endif
[184]46
[95]47ifneq ($(PATH_TOOL_NASM),)
[667]48 TOOL_NASM_AS ?= $(PATH_TOOL_NASM)/nasm$(HOSTSUFF_EXE)
[95]49else
[667]50 TOOL_NASM_AS ?= nasm$(HOSTSUFF_EXE)
[95]51endif
52
[2873]53# kSubmit
54ifdef TOOL_NASM_USE_KSUBMIT
55 ifeq ($(KBUILD_HOST),win)
56 TOOL_NASM_KSUBMIT ?= kmk_builtin_kSubmit $1 --
57 endif
58endif
59
[667]60# General Properties used by kBuild
61TOOL_NASM_ASFLAGS ?=
[95]62
[667]63
[95]64## Compile Assembly source.
65# @param $(target) Normalized main target name.
66# @param $(source) Source filename (relative).
[235]67# @param $(obj) Object file name. This shall be (re)created by the compilation.
68# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
[95]69# @param $(flags) Flags.
70# @param $(defs) Definitions. No -D or something.
71# @param $(incs) Includes. No -I or something.
[235]72# @param $(dirdep) Directory creation dependency.
73# @param $(deps) Other dependencies.
[95]74# @param $(outbase) Output basename (full). Use this for list files and such.
[235]75# @param $(objsuff) Object suffix.
[380]76#
77TOOL_NASM_COMPILE_AS_OUTPUT = $(outbase).lst
78TOOL_NASM_COMPILE_AS_DEPEND =
79TOOL_NASM_COMPILE_AS_DEPORD =
80define TOOL_NASM_COMPILE_AS_CMDS
[2873]81ifdef TOOL_NASM_KSUBMIT
82 $(QUIET)$(call TOOL_NASM_KSUBMIT, -C $(PATH_OUT_BASE)) $(TOOL_NASM_AS)\
[3520]83 $(flags) $(qaddsuffix sh,/,$(qaddprefix ,-i, $(incs))) $(qaddprefix sh,-D, $(defs))\
[380]84 -l $(outbase).lst\
85 -o $(obj)\
[2890]86 -MD "$(dep)" -MP\
[3520]87 $(qabspath sh,$(source))
[2873]88else
[2929]89 $(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE) -- $(TOOL_NASM_AS)\
[3520]90 $(flags) $(qaddsuffix sh,/,$(qaddprefix ,-i, $(incs))) $(qaddprefix sh,-D, $(defs))\
[2873]91 -l $(outbase).lst\
92 -o $(obj)\
[2890]93 -MD "$(dep)" -MP\
[3520]94 $(qabspath sh,$(source))
[2873]95endif
[95]96endef
97
Note: See TracBrowser for help on using the repository browser.