1 | # $Id: NASM.kmk 2929 2016-09-16 21:19:14Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild Tool Config - Netwide Assembler v0.98+.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2004-2014 knut st. osmundsen <bird-kBuild-spam-xiv@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 |
|
---|
34 | TOOL_NASM := Netwide Assembler v0.98+
|
---|
35 |
|
---|
36 | # Tool Specific Properties
|
---|
37 | ifndef PATH_TOOL_NASM
|
---|
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*.*)))
|
---|
41 | endif
|
---|
42 | else
|
---|
43 | # Resolve any fancy stuff once and for all.
|
---|
44 | PATH_TOOL_NASM := $(PATH_TOOL_NASM)
|
---|
45 | endif
|
---|
46 |
|
---|
47 | ifneq ($(PATH_TOOL_NASM),)
|
---|
48 | TOOL_NASM_AS ?= $(PATH_TOOL_NASM)/nasm$(HOSTSUFF_EXE)
|
---|
49 | else
|
---|
50 | TOOL_NASM_AS ?= nasm$(HOSTSUFF_EXE)
|
---|
51 | endif
|
---|
52 |
|
---|
53 | # kSubmit
|
---|
54 | ifdef TOOL_NASM_USE_KSUBMIT
|
---|
55 | ifeq ($(KBUILD_HOST),win)
|
---|
56 | TOOL_NASM_KSUBMIT ?= kmk_builtin_kSubmit $1 --
|
---|
57 | endif
|
---|
58 | endif
|
---|
59 |
|
---|
60 | # General Properties used by kBuild
|
---|
61 | TOOL_NASM_ASFLAGS ?=
|
---|
62 |
|
---|
63 |
|
---|
64 | ## Compile Assembly source.
|
---|
65 | # @param $(target) Normalized main target name.
|
---|
66 | # @param $(source) Source filename (relative).
|
---|
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.
|
---|
69 | # @param $(flags) Flags.
|
---|
70 | # @param $(defs) Definitions. No -D or something.
|
---|
71 | # @param $(incs) Includes. No -I or something.
|
---|
72 | # @param $(dirdep) Directory creation dependency.
|
---|
73 | # @param $(deps) Other dependencies.
|
---|
74 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
75 | # @param $(objsuff) Object suffix.
|
---|
76 | #
|
---|
77 | TOOL_NASM_COMPILE_AS_OUTPUT = $(outbase).lst
|
---|
78 | TOOL_NASM_COMPILE_AS_DEPEND =
|
---|
79 | TOOL_NASM_COMPILE_AS_DEPORD =
|
---|
80 | define TOOL_NASM_COMPILE_AS_CMDS
|
---|
81 | ifdef TOOL_NASM_KSUBMIT
|
---|
82 | $(QUIET)$(call TOOL_NASM_KSUBMIT, -C $(PATH_OUT_BASE)) $(TOOL_NASM_AS)\
|
---|
83 | $(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
|
---|
84 | -l $(outbase).lst\
|
---|
85 | -o $(obj)\
|
---|
86 | -MD "$(dep)" -MP\
|
---|
87 | $(abspath $(source))
|
---|
88 | else
|
---|
89 | $(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE) -- $(TOOL_NASM_AS)\
|
---|
90 | $(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
|
---|
91 | -l $(outbase).lst\
|
---|
92 | -o $(obj)\
|
---|
93 | -MD "$(dep)" -MP\
|
---|
94 | $(abspath $(source))
|
---|
95 | endif
|
---|
96 | endef
|
---|
97 |
|
---|