source: trunk/kBuild/tools/OPENWATCOM.kmk@ 2663

Last change on this file since 2663 was 2663, checked in by bird, 13 years ago

OPENWATCOM-WL.kmk: Fixed double slashes in wlink response file on Windows and OS/2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.4 KB
Line 
1# $Id: OPENWATCOM.kmk 2663 2012-10-15 13:13:45Z 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
34TOOL_OPENWATCOM = Open Watcom v1.4 and later (generic)
35
36ifeq ($(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.
53else
54 # Resolve any fancy stuff once and for all.
55 PATH_TOOL_OPENWATCOM := $(PATH_TOOL_OPENWATCOM)
56endif
57
58ifneq ($(PATH_TOOL_OPENWATCOM),)
59 TOOL_OPENWATCOM_PATHLESS := no
60
61 ifeq ($(KBUILD_HOST),darwin)
62 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binosx
63 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
64 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
65 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
66 -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
67 -E 'LIB=$1' \
68 -E 'INCLUDE=' \
69 --
70 else ifeq ($(KBUILD_HOST),freebsd)
71 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binfbsd
72 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
73 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
74 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
75 -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
76 -E 'LIB=$1' \
77 -E 'INCLUDE=' \
78 --
79 else ifeq ($(KBUILD_HOST),linux)
80 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binl
81 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
82 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
83 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
84 -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
85 -E 'LIB=$1' \
86 -E 'INCLUDE=' \
87 --
88 else ifeq ($(KBUILD_HOST),os2)
89 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binp
90 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
91 -E 'BEGINLIBPATH=$(PATH_TOOL_OPENWATCOM)/binp/dll;$(BEGINLIBPATH)' \
92 -E 'LIBPATHSTRICT=T' \
93 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw;$(PATH)' \
94 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
95 -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
96 -E 'LIB=$1' \
97 -E 'INCLUDE=' \
98 --
99 else ifeq ($(KBUILD_HOST),solaris)
100 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binsol
101 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
102 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN):$(PATH_TOOL_OPENWATCOM)/binl:$(PATH_TOOL_OPENWATCOM)/binw:$(PATH)' \
103 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
104 -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
105 -E 'LIB=$1' \
106 -E 'INCLUDE=' \
107 --
108 else
109 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binnt
110 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
111 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN);$(PATH_TOOL_OPENWATCOM)/binw;$(PATH)' \
112 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
113 -E 'EDPATH=$(PATH_TOOL_OPENWATCOM)/EDDAT' \
114 -E 'LIB=$1' \
115 -E 'INCLUDE=' \
116 --
117 endif
118
119 TOOL_OPENWATCOM_CC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc386$(HOSTSUFF_EXE)
120 TOOL_OPENWATCOM_CC16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc$(HOSTSUFF_EXE)
121 TOOL_OPENWATCOM_CXX ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp386$(HOSTSUFF_EXE)
122 TOOL_OPENWATCOM_CXX16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp$(HOSTSUFF_EXE)
123 TOOL_OPENWATCOM_AS ?= $(PATH_TOOL_OPENWATCOM_BIN)/wasm$(HOSTSUFF_EXE)
124 TOOL_OPENWATCOM_AR ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlib$(HOSTSUFF_EXE)
125 TOOL_OPENWATCOM_RC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wrc$(HOSTSUFF_EXE)
126 TOOL_OPENWATCOM_LD ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl386$(HOSTSUFF_EXE)
127 TOOL_OPENWATCOM_LD16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl$(HOSTSUFF_EXE)
128 TOOL_OPENWATCOM_WLINK ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlink$(HOSTSUFF_EXE)
129
130else
131 # Pathless, relies on the environment.
132 TOOL_OPENWATCOM_PATHLESS :=
133 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
134 -E 'LIB=$1' \
135 -E 'INCLUDE=' \
136 --
137 TOOL_OPENWATCOM_CC ?= wcc386$(HOSTSUFF_EXE)
138 TOOL_OPENWATCOM_CC16 ?= wcc$(HOSTSUFF_EXE)
139 TOOL_OPENWATCOM_CXX ?= wpp386$(HOSTSUFF_EXE)
140 TOOL_OPENWATCOM_CXX16 ?= wpp$(HOSTSUFF_EXE)
141 TOOL_OPENWATCOM_AS ?= wasm$(HOSTSUFF_EXE)
142 TOOL_OPENWATCOM_AR ?= wlib$(HOSTSUFF_EXE)
143 TOOL_OPENWATCOM_RC ?= wrc$(HOSTSUFF_EXE)
144 TOOL_OPENWATCOM_LD ?= wcl386$(HOSTSUFF_EXE)
145 TOOL_OPENWATCOM_LD16 ?= wcl$(HOSTSUFF_EXE)
146 TOOL_OPENWATCOM_WLINK ?= wlink$(HOSTSUFF_EXE)
147
148endif
149
150# Functions for changing slashes (SQ = single quoted).
151if1of ($(KBUILD_HOST), os2 win)
152 TOOL_OPENWATCOM_FIX_SLASHES = $(subst /,\\,$1)
153 TOOL_OPENWATCOM_FIX_SLASHES_SQ = $(subst /,\,$1)
154else
155 TOOL_OPENWATCOM_FIX_SLASHES = $1
156 TOOL_OPENWATCOM_FIX_SLASHES_SQ = $1
157endif
158
159# General Properties used by kBuild
160TOOL_OPENWATCOM_ASOBJSUFF ?= .obj
161TOOL_OPENWATCOM_ASFLAGS ?= -zq
162TOOL_OPENWATCOM_ASFLAGS.dos ?= -bt=dos
163TOOL_OPENWATCOM_ASFLAGS.os2 ?= -bt=os2
164TOOL_OPENWATCOM_ASFLAGS.win ?= -bt=nt
165
166TOOL_OPENWATCOM_COBJSUFF ?= .obj
167TOOL_OPENWATCOM_CFLAGS ?= -zq
168TOOL_OPENWATCOM_CFLAGS.dos ?= -bt=dos
169TOOL_OPENWATCOM_CFLAGS.os2 ?= -bt=os2
170TOOL_OPENWATCOM_CFLAGS.win ?= -bt=nt
171ifdef PATH_TOOL_OPENWATCOM
172 TOOL_OPENWATCOM_CINCS ?= $(PATH_TOOL_OPENWATCOM)/h
173endif
174
175TOOL_OPENWATCOM_CXXOBJSUFF ?= .obj
176TOOL_OPENWATCOM_CXXFLAGS ?= -zq
177TOOL_OPENWATCOM_CXXFLAGS.dos ?= -bt=dos
178TOOL_OPENWATCOM_CXXFLAGS.os2 ?= -bt=os2
179TOOL_OPENWATCOM_CXXFLAGS.win ?= -bt=nt
180ifdef PATH_TOOL_OPENWATCOM
181 TOOL_OPENWATCOM_CXXINCS ?= $(PATH_TOOL_OPENWATCOM)/h
182endif
183
184TOOL_OPENWATCOM_RCOBJSUFF ?= .res
185TOOL_OPENWATCOM_RCFLAGS ?= -r
186TOOL_OPENWATCOM_RCFLAGS.os2 ?= -bt=os2
187TOOL_OPENWATCOM_RCFLAGS.win ?= -bt=nt
188ifdef PATH_TOOL_OPENWATCOM
189 TOOL_OPENWATCOM_RCINCS ?= $(PATH_TOOL_OPENWATCOM)/h
190endif
191
192TOOL_OPENWATCOM_ARFLAGS ?= -q
193TOOL_OPENWATCOM_ARLIBSUFF ?= .lib
194
195TOOL_OPENWATCOM_LDFLAGS ?= -zq -y
196TOOL_OPENWATCOM_LDFLAGS.dos ?= -bt=dos
197TOOL_OPENWATCOM_LDFLAGS.os2 ?= -bt=os2
198TOOL_OPENWATCOM_LDFLAGS.win ?= -bt=nt
199
200
201TOOL_OPENWATCOM_COMPILE_AS_DEPEND =
202TOOL_OPENWATCOM_COMPILE_AS_DEPORD =
203TOOL_OPENWATCOM_COMPILE_AS_OUTPUT = $(obj).err
204define TOOL_OPENWATCOM_COMPILE_AS_CMDS
205 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AS) \
206 $(flags) \
207 $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
208 $(addprefix -d, $(defs)) \
209 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
210 -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
211 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
212 $(QUIET)$(APPEND) -n $(obj).err
213## @todo dependencies
214endef
215
216
217TOOL_OPENWATCOM_COMPILE_C_DEPEND =
218TOOL_OPENWATCOM_COMPILE_C_DEPORD =
219TOOL_OPENWATCOM_COMPILE_C_OUTPUT = $(obj).err
220define TOOL_OPENWATCOM_COMPILE_C_CMDS
221 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC) \
222 $(flags) \
223 $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
224 $(addprefix -d, $(defs)) \
225 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
226 -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
227 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
228 $(QUIET)$(APPEND) -n $(obj).err
229## @todo dependencies
230endef
231
232TOOL_OPENWATCOM_COMPILE_CXX_DEPEND =
233TOOL_OPENWATCOM_COMPILE_CXX_DEPORD =
234TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT = $(obj).err
235define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
236 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CXX) \
237 $(flags) \
238 $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
239 $(addprefix -d, $(defs)) \
240 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
241 -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
242 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
243 $(QUIET)$(APPEND) -n $(obj).err
244## @todo dependencies
245endef
246
247TOOL_OPENWATCOM_COMPILE_RC_OUTPUT =
248TOOL_OPENWATCOM_COMPILE_RC_DEPEND =
249TOOL_OPENWATCOM_COMPILE_RC_DEPORD =
250define TOOL_OPENWATCOM_COMPILE_RC_CMDS
251 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \
252 $(TOOL_OPENWATCOM_RC) -r\
253 $(flags) \
254 $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \
255 $(addprefix -d, $(defs))\
256 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
257 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
258endef
259
260TOOL_OPENWATCOM_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp
261TOOL_OPENWATCOM_LINK_LIBRARY_DEPEND = $(othersrc)
262TOOL_OPENWATCOM_LINK_LIBRARY_DEPORD =
263define TOOL_OPENWATCOM_LINK_LIBRARY_CMDS
264 $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(objs) $(othersrc)),'+"$(obj)"')
265 $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) @$(outbase).rsp
266endef
267
268TOOL_OPENWATCOM_LINK_PROGRAM_OUTPUT = $(outbase).map
269TOOL_OPENWATCOM_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
270TOOL_OPENWATCOM_LINK_PROGRAM_DEPORD =
271define TOOL_OPENWATCOM_LINK_PROGRAM_CMDS
272 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
273 $(TOOL_OPENWATCOM_LD) \
274 $(flags) \
275 -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
276 -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
277 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
278 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
279 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
280 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
281 $(TOOL_OPENWATCOM_RC) \
282 $(filter -bt=%,$(flags)) \
283 /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
284 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
285endef
286
287TOOL_OPENWATCOM_LINK_DLL_OUTPUT = $(outbase).map
288TOOL_OPENWATCOM_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
289TOOL_OPENWATCOM_LINK_DLL_DEPORD =
290define TOOL_OPENWATCOM_LINK_DLL_CMDS
291 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
292 $(TOOL_OPENWATCOM_LD) \
293 $(flags) \
294 -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
295 -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
296 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
297 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
298 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
299 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
300 $(TOOL_OPENWATCOM_RC) \
301 $(filter -bt=%,$(flags)) \
302 /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
303 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
304endef
305
306TOOL_OPENWATCOM_LINK_SYSMOD_OUTPUT = $(outbase).map
307TOOL_OPENWATCOM_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
308TOOL_OPENWATCOM_LINK_SYSMOD_DEPORD =
309define TOOL_OPENWATCOM_LINK_SYSMOD_CMDS
310 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
311 $(TOOL_OPENWATCOM_LD) \
312 $(flags) \
313 -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
314 -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
315 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
316 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
317 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
318 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
319 $(TOOL_OPENWATCOM_RC) \
320 $(filter -bt=%,$(flags)) \
321 /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
322 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
323endef
324
Note: See TracBrowser for help on using the repository browser.