1 | # $Id: OPENWATCOM.kmk 2413 2010-09-11 17:43:04Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild Tool Config - Open Watcom v1.4 and later.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2008-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 |
|
---|
34 | TOOL_OPENWATCOM = Open Watcom v1.4 and later (generic)
|
---|
35 |
|
---|
36 | ifeq ($(PATH_TOOL_OPENWATCOM),)
|
---|
37 | ifeq ($(PATH_TOOL_OPENWATCOM),)
|
---|
38 | PATH_TOOL_OPENWATCOM := $(wildcard $(PATH_DEVTOOLS_BLD)/openwatcom/v*)
|
---|
39 | endif
|
---|
40 | ifeq ($(PATH_TOOL_OPENWATCOM),)
|
---|
41 | PATH_TOOL_OPENWATCOM := $(wildcard $(PATH_DEVTOOLS_TRG)/openwatcom/v*)
|
---|
42 | endif
|
---|
43 | ifeq ($(PATH_TOOL_OPENWATCOM),)
|
---|
44 | PATH_TOOL_OPENWATCOM := $(wildcard $(PATH_DEVTOOLS)/common/openwatcom/v*)
|
---|
45 | endif
|
---|
46 | ifeq ($(PATH_TOOL_OPENWATCOM)$(KBUILD_HOST),os2)
|
---|
47 | if1of ($(USER) $(USERNAME) $(LOGNAME), bird)
|
---|
48 | PATH_TOOL_OPENWATCOM := $(wildcard d:/dev/Watcom/v1.*)
|
---|
49 | endif
|
---|
50 | endif
|
---|
51 | PATH_TOOL_OPENWATCOM := $(firstword $(sort $(PATH_TOOL_OPENWATCOM)))
|
---|
52 | # if not found, we'll enter 'pathless' mode.
|
---|
53 | else
|
---|
54 | # Resolve any fancy stuff once and for all.
|
---|
55 | PATH_TOOL_OPENWATCOM := $(PATH_TOOL_OPENWATCOM)
|
---|
56 | endif
|
---|
57 |
|
---|
58 | ifneq ($(PATH_TOOL_OPENWATCOM),)
|
---|
59 | TOOL_OPENWATCOM_PATHLESS := no
|
---|
60 |
|
---|
61 | ifeq ($(KBUILD_HOST),os2)
|
---|
62 | PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binp
|
---|
63 | TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
|
---|
64 | -E 'BEGINLIBPATH=$(PATH_TOOL_OPENWATCOM)/binp/dll;$(BEGINLIBPATH)' \
|
---|
65 | -E 'LIBPATHSTRICT=T' \
|
---|
66 | -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw' \
|
---|
67 | -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
|
---|
68 | -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
|
---|
69 | -E 'LIB=$1' \
|
---|
70 | -E 'INCLUDE=' \
|
---|
71 | --
|
---|
72 | else ifeq ($(KBUILD_HOST),linux)
|
---|
73 | PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binl
|
---|
74 | TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
|
---|
75 | -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binw' \
|
---|
76 | -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
|
---|
77 | -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
|
---|
78 | -E 'LIB=$1' \
|
---|
79 | -E 'INCLUDE=' \
|
---|
80 | --
|
---|
81 | else
|
---|
82 | PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binnt
|
---|
83 | TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
|
---|
84 | -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw' \
|
---|
85 | -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
|
---|
86 | -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
|
---|
87 | -E 'LIB=$1' \
|
---|
88 | -E 'INCLUDE=' \
|
---|
89 | --
|
---|
90 | endif
|
---|
91 |
|
---|
92 | TOOL_OPENWATCOM_CC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc386$(HOSTSUFF_EXE)
|
---|
93 | TOOL_OPENWATCOM_CC16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc$(HOSTSUFF_EXE)
|
---|
94 | TOOL_OPENWATCOM_CXX ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp386$(HOSTSUFF_EXE)
|
---|
95 | TOOL_OPENWATCOM_CXX16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp$(HOSTSUFF_EXE)
|
---|
96 | TOOL_OPENWATCOM_AS ?= $(PATH_TOOL_OPENWATCOM_BIN)/wasm$(HOSTSUFF_EXE)
|
---|
97 | TOOL_OPENWATCOM_AR ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlib$(HOSTSUFF_EXE)
|
---|
98 | TOOL_OPENWATCOM_RC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wrc$(HOSTSUFF_EXE)
|
---|
99 | TOOL_OPENWATCOM_LD ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl386$(HOSTSUFF_EXE)
|
---|
100 | TOOL_OPENWATCOM_LD16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl$(HOSTSUFF_EXE)
|
---|
101 | TOOL_OPENWATCOM_WLINK ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlink$(HOSTSUFF_EXE)
|
---|
102 |
|
---|
103 | else
|
---|
104 | # Pathless, relies on the environment.
|
---|
105 | TOOL_OPENWATCOM_PATHLESS :=
|
---|
106 | TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
|
---|
107 | -E 'LIB=$1' \
|
---|
108 | -E 'INCLUDE=' \
|
---|
109 | --
|
---|
110 | TOOL_OPENWATCOM_CC ?= wcc386$(HOSTSUFF_EXE)
|
---|
111 | TOOL_OPENWATCOM_CC16 ?= wcc$(HOSTSUFF_EXE)
|
---|
112 | TOOL_OPENWATCOM_CXX ?= wpp386$(HOSTSUFF_EXE)
|
---|
113 | TOOL_OPENWATCOM_CXX16 ?= wpp$(HOSTSUFF_EXE)
|
---|
114 | TOOL_OPENWATCOM_AS ?= wasm$(HOSTSUFF_EXE)
|
---|
115 | TOOL_OPENWATCOM_AR ?= wlib$(HOSTSUFF_EXE)
|
---|
116 | TOOL_OPENWATCOM_RC ?= wrc$(HOSTSUFF_EXE)
|
---|
117 | TOOL_OPENWATCOM_LD ?= wcl386$(HOSTSUFF_EXE)
|
---|
118 | TOOL_OPENWATCOM_LD16 ?= wcl$(HOSTSUFF_EXE)
|
---|
119 | TOOL_OPENWATCOM_WLINK ?= wlink$(HOSTSUFF_EXE)
|
---|
120 |
|
---|
121 | endif
|
---|
122 |
|
---|
123 | # General Properties used by kBuild
|
---|
124 | TOOL_OPENWATCOM_ASOBJSUFF ?= .obj
|
---|
125 | TOOL_OPENWATCOM_ASFLAGS ?= -zq
|
---|
126 | TOOL_OPENWATCOM_ASFLAGS.dos ?= -bt=dos
|
---|
127 | TOOL_OPENWATCOM_ASFLAGS.os2 ?= -bt=os2
|
---|
128 | TOOL_OPENWATCOM_ASFLAGS.win ?= -bt=nt
|
---|
129 |
|
---|
130 | TOOL_OPENWATCOM_COBJSUFF ?= .obj
|
---|
131 | TOOL_OPENWATCOM_CFLAGS ?= -zq
|
---|
132 | TOOL_OPENWATCOM_CFLAGS.dos ?= -bt=dos
|
---|
133 | TOOL_OPENWATCOM_CFLAGS.os2 ?= -bt=os2
|
---|
134 | TOOL_OPENWATCOM_CFLAGS.win ?= -bt=nt
|
---|
135 | ifdef PATH_TOOL_OPENWATCOM
|
---|
136 | TOOL_OPENWATCOM_CINCS ?= $(PATH_TOOL_OPENWATCOM)/h
|
---|
137 | endif
|
---|
138 |
|
---|
139 | TOOL_OPENWATCOM_CXXOBJSUFF ?= .obj
|
---|
140 | TOOL_OPENWATCOM_CXXFLAGS ?= -zq
|
---|
141 | TOOL_OPENWATCOM_CXXFLAGS.dos ?= -bt=dos
|
---|
142 | TOOL_OPENWATCOM_CXXFLAGS.os2 ?= -bt=os2
|
---|
143 | TOOL_OPENWATCOM_CXXFLAGS.win ?= -bt=nt
|
---|
144 | ifdef PATH_TOOL_OPENWATCOM
|
---|
145 | TOOL_OPENWATCOM_CXXINCS ?= $(PATH_TOOL_OPENWATCOM)/h
|
---|
146 | endif
|
---|
147 |
|
---|
148 | TOOL_OPENWATCOM_RCOBJSUFF ?= .res
|
---|
149 | TOOL_OPENWATCOM_RCFLAGS ?= -r
|
---|
150 | TOOL_OPENWATCOM_RCFLAGS.os2 ?= -bt=os2
|
---|
151 | TOOL_OPENWATCOM_RCFLAGS.win ?= -bt=nt
|
---|
152 | ifdef PATH_TOOL_OPENWATCOM
|
---|
153 | TOOL_OPENWATCOM_RCINCS ?= $(PATH_TOOL_OPENWATCOM)/h
|
---|
154 | endif
|
---|
155 |
|
---|
156 | TOOL_OPENWATCOM_ARFLAGS ?= -q
|
---|
157 | TOOL_OPENWATCOM_ARLIBSUFF ?= .lib
|
---|
158 |
|
---|
159 | TOOL_OPENWATCOM_LDFLAGS ?= -zq -y
|
---|
160 | TOOL_OPENWATCOM_LDFLAGS.dos ?= -bt=dos
|
---|
161 | TOOL_OPENWATCOM_LDFLAGS.os2 ?= -bt=os2
|
---|
162 | TOOL_OPENWATCOM_LDFLAGS.win ?= -bt=nt
|
---|
163 |
|
---|
164 |
|
---|
165 | TOOL_OPENWATCOM_COMPILE_AS_DEPEND =
|
---|
166 | TOOL_OPENWATCOM_COMPILE_AS_DEPORD =
|
---|
167 | TOOL_OPENWATCOM_COMPILE_AS_OUTPUT = $(obj).err
|
---|
168 | define TOOL_OPENWATCOM_COMPILE_AS_CMDS
|
---|
169 | $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AS) \
|
---|
170 | $(flags) \
|
---|
171 | $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
|
---|
172 | $(addprefix -d, $(defs)) \
|
---|
173 | -fo=$(subst /,\\,$(obj)) \
|
---|
174 | -fr=$(subst /,\\,$(obj)).err \
|
---|
175 | $(subst /,\\,$(abspath $(source)))
|
---|
176 | $(QUIET)$(APPEND) -n $(obj).err
|
---|
177 | ## @todo dependencies
|
---|
178 | endef
|
---|
179 |
|
---|
180 |
|
---|
181 | TOOL_OPENWATCOM_COMPILE_C_DEPEND =
|
---|
182 | TOOL_OPENWATCOM_COMPILE_C_DEPORD =
|
---|
183 | TOOL_OPENWATCOM_COMPILE_C_OUTPUT = $(obj).err
|
---|
184 | define TOOL_OPENWATCOM_COMPILE_C_CMDS
|
---|
185 | $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC) \
|
---|
186 | $(flags) \
|
---|
187 | $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
|
---|
188 | $(addprefix -d, $(defs)) \
|
---|
189 | -fo=$(subst /,\\,$(obj)) \
|
---|
190 | -fr=$(subst /,\\,$(obj)).err \
|
---|
191 | $(subst /,\\,$(abspath $(source)))
|
---|
192 | $(QUIET)$(APPEND) -n $(obj).err
|
---|
193 | ## @todo dependencies
|
---|
194 | endef
|
---|
195 |
|
---|
196 | TOOL_OPENWATCOM_COMPILE_CXX_DEPEND =
|
---|
197 | TOOL_OPENWATCOM_COMPILE_CXX_DEPORD =
|
---|
198 | TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT = $(obj).err
|
---|
199 | define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
|
---|
200 | $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CXX) \
|
---|
201 | $(flags) \
|
---|
202 | $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
|
---|
203 | $(addprefix -d, $(defs)) \
|
---|
204 | -fo=$(subst /,\\,$(obj)) \
|
---|
205 | -fr=$(subst /,\\,$(obj)).err \
|
---|
206 | $(subst /,\\,$(abspath $(source)))
|
---|
207 | $(QUIET)$(APPEND) -n $(obj).err
|
---|
208 | ## @todo dependencies
|
---|
209 | endef
|
---|
210 |
|
---|
211 | TOOL_OPENWATCOM_COMPILE_RC_OUTPUT =
|
---|
212 | TOOL_OPENWATCOM_COMPILE_RC_DEPEND =
|
---|
213 | TOOL_OPENWATCOM_COMPILE_RC_DEPORD =
|
---|
214 | define TOOL_OPENWATCOM_COMPILE_RC_CMDS
|
---|
215 | $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \
|
---|
216 | $(TOOL_OPENWATCOM_RC) -r\
|
---|
217 | $(flags) \
|
---|
218 | $(addprefix -i=, $(subst /,\\,$(incs))) \
|
---|
219 | $(addprefix -d, $(defs))\
|
---|
220 | -fo=$(subst /,\\,$(obj)) \
|
---|
221 | $(subst /,\\,$(abspath $(source)))
|
---|
222 | endef
|
---|
223 |
|
---|
224 | TOOL_OPENWATCOM_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp
|
---|
225 | TOOL_OPENWATCOM_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
226 | TOOL_OPENWATCOM_LINK_LIBRARY_DEPORD =
|
---|
227 | define TOOL_OPENWATCOM_LINK_LIBRARY_CMDS
|
---|
228 | $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(subst /,\,$(objs) $(othersrc)),'+"$(obj)"')
|
---|
229 | $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(subst /,\\,$(out)) @$(outbase).rsp
|
---|
230 | endef
|
---|
231 |
|
---|
232 | TOOL_OPENWATCOM_LINK_PROGRAM_OUTPUT = $(outbase).map
|
---|
233 | TOOL_OPENWATCOM_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
|
---|
234 | TOOL_OPENWATCOM_LINK_PROGRAM_DEPORD =
|
---|
235 | define TOOL_OPENWATCOM_LINK_PROGRAM_CMDS
|
---|
236 | $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
|
---|
237 | $(TOOL_OPENWATCOM_LD) \
|
---|
238 | $(flags) \
|
---|
239 | -fe=$(subst /,\\,$(out)) \
|
---|
240 | -fm=$(subst /,\\,$(outbase).map) \
|
---|
241 | $(subst /,\\,$(filter-out %.res,$(objs))) \
|
---|
242 | $(subst /,\\,$(libs)) \
|
---|
243 | $(subst /,\\,$(othersrc))
|
---|
244 | $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
|
---|
245 | $(TOOL_OPENWATCOM_RC) \
|
---|
246 | $(filter -bt=%,$(flags)) \
|
---|
247 | /fe=$(subst /,\\,$(out)) \
|
---|
248 | $(subst /,\\,$(filter %.res,$(objs))))
|
---|
249 | endef
|
---|
250 |
|
---|
251 | TOOL_OPENWATCOM_LINK_DLL_OUTPUT = $(outbase).map
|
---|
252 | TOOL_OPENWATCOM_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
|
---|
253 | TOOL_OPENWATCOM_LINK_DLL_DEPORD =
|
---|
254 | define TOOL_OPENWATCOM_LINK_DLL_CMDS
|
---|
255 | $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
|
---|
256 | $(TOOL_OPENWATCOM_LD) \
|
---|
257 | $(flags) \
|
---|
258 | -fe=$(subst /,\\,$(out)) \
|
---|
259 | -fm=$(subst /,\\,$(outbase).map) \
|
---|
260 | $(subst /,\\,$(filter-out %.res,$(objs))) \
|
---|
261 | $(subst /,\\,$(libs)) \
|
---|
262 | $(subst /,\\,$(othersrc))
|
---|
263 | $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
|
---|
264 | $(TOOL_OPENWATCOM_RC) \
|
---|
265 | $(filter -bt=%,$(flags)) \
|
---|
266 | /fe=$(subst /,\\,$(out)) \
|
---|
267 | $(subst /,\\,$(filter %.res,$(objs))))
|
---|
268 | endef
|
---|
269 |
|
---|
270 | TOOL_OPENWATCOM_LINK_SYSMOD_OUTPUT = $(outbase).map
|
---|
271 | TOOL_OPENWATCOM_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
|
---|
272 | TOOL_OPENWATCOM_LINK_SYSMOD_DEPORD =
|
---|
273 | define TOOL_OPENWATCOM_LINK_SYSMOD_CMDS
|
---|
274 | $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
|
---|
275 | $(TOOL_OPENWATCOM_LD) \
|
---|
276 | $(flags) \
|
---|
277 | -fe=$(subst /,\\,$(out)) \
|
---|
278 | -fm=$(subst /,\\,$(outbase).map) \
|
---|
279 | $(subst /,\\,$(filter-out %.res,$(objs))) \
|
---|
280 | $(subst /,\\,$(libs)) \
|
---|
281 | $(subst /,\\,$(othersrc))
|
---|
282 | $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
|
---|
283 | $(TOOL_OPENWATCOM_RC) \
|
---|
284 | $(filter -bt=%,$(flags)) \
|
---|
285 | /fe=$(subst /,\\,$(out)) \
|
---|
286 | $(subst /,\\,$(filter %.res,$(objs))))
|
---|
287 | endef
|
---|
288 |
|
---|