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

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

OPENWATCOM.kmk: wlink.lnk is searching in the path, we prefer the linux one for OS X, FreeBSD or Solaris if it's in missing in the host specific bin directory. (The dos one contains the wrong slashes and env.var. casing.)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.3 KB
Line 
1# $Id: OPENWATCOM.kmk 2576 2012-05-31 15:07:00Z 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
150if1of ($(KBUILD_HOST), os2 win)
151 TOOL_OPENWATCOM_FIX_SLASHES = $(subst /,\\,$1)
152else
153 TOOL_OPENWATCOM_FIX_SLASHES = $1
154endif
155
156# General Properties used by kBuild
157TOOL_OPENWATCOM_ASOBJSUFF ?= .obj
158TOOL_OPENWATCOM_ASFLAGS ?= -zq
159TOOL_OPENWATCOM_ASFLAGS.dos ?= -bt=dos
160TOOL_OPENWATCOM_ASFLAGS.os2 ?= -bt=os2
161TOOL_OPENWATCOM_ASFLAGS.win ?= -bt=nt
162
163TOOL_OPENWATCOM_COBJSUFF ?= .obj
164TOOL_OPENWATCOM_CFLAGS ?= -zq
165TOOL_OPENWATCOM_CFLAGS.dos ?= -bt=dos
166TOOL_OPENWATCOM_CFLAGS.os2 ?= -bt=os2
167TOOL_OPENWATCOM_CFLAGS.win ?= -bt=nt
168ifdef PATH_TOOL_OPENWATCOM
169 TOOL_OPENWATCOM_CINCS ?= $(PATH_TOOL_OPENWATCOM)/h
170endif
171
172TOOL_OPENWATCOM_CXXOBJSUFF ?= .obj
173TOOL_OPENWATCOM_CXXFLAGS ?= -zq
174TOOL_OPENWATCOM_CXXFLAGS.dos ?= -bt=dos
175TOOL_OPENWATCOM_CXXFLAGS.os2 ?= -bt=os2
176TOOL_OPENWATCOM_CXXFLAGS.win ?= -bt=nt
177ifdef PATH_TOOL_OPENWATCOM
178 TOOL_OPENWATCOM_CXXINCS ?= $(PATH_TOOL_OPENWATCOM)/h
179endif
180
181TOOL_OPENWATCOM_RCOBJSUFF ?= .res
182TOOL_OPENWATCOM_RCFLAGS ?= -r
183TOOL_OPENWATCOM_RCFLAGS.os2 ?= -bt=os2
184TOOL_OPENWATCOM_RCFLAGS.win ?= -bt=nt
185ifdef PATH_TOOL_OPENWATCOM
186 TOOL_OPENWATCOM_RCINCS ?= $(PATH_TOOL_OPENWATCOM)/h
187endif
188
189TOOL_OPENWATCOM_ARFLAGS ?= -q
190TOOL_OPENWATCOM_ARLIBSUFF ?= .lib
191
192TOOL_OPENWATCOM_LDFLAGS ?= -zq -y
193TOOL_OPENWATCOM_LDFLAGS.dos ?= -bt=dos
194TOOL_OPENWATCOM_LDFLAGS.os2 ?= -bt=os2
195TOOL_OPENWATCOM_LDFLAGS.win ?= -bt=nt
196
197
198TOOL_OPENWATCOM_COMPILE_AS_DEPEND =
199TOOL_OPENWATCOM_COMPILE_AS_DEPORD =
200TOOL_OPENWATCOM_COMPILE_AS_OUTPUT = $(obj).err
201define TOOL_OPENWATCOM_COMPILE_AS_CMDS
202 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AS) \
203 $(flags) \
204 $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
205 $(addprefix -d, $(defs)) \
206 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
207 -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
208 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
209 $(QUIET)$(APPEND) -n $(obj).err
210## @todo dependencies
211endef
212
213
214TOOL_OPENWATCOM_COMPILE_C_DEPEND =
215TOOL_OPENWATCOM_COMPILE_C_DEPORD =
216TOOL_OPENWATCOM_COMPILE_C_OUTPUT = $(obj).err
217define TOOL_OPENWATCOM_COMPILE_C_CMDS
218 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC) \
219 $(flags) \
220 $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
221 $(addprefix -d, $(defs)) \
222 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
223 -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
224 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
225 $(QUIET)$(APPEND) -n $(obj).err
226## @todo dependencies
227endef
228
229TOOL_OPENWATCOM_COMPILE_CXX_DEPEND =
230TOOL_OPENWATCOM_COMPILE_CXX_DEPORD =
231TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT = $(obj).err
232define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
233 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CXX) \
234 $(flags) \
235 $(addsuffix , $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs)))) \
236 $(addprefix -d, $(defs)) \
237 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
238 -fr=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)).err \
239 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
240 $(QUIET)$(APPEND) -n $(obj).err
241## @todo dependencies
242endef
243
244TOOL_OPENWATCOM_COMPILE_RC_OUTPUT =
245TOOL_OPENWATCOM_COMPILE_RC_DEPEND =
246TOOL_OPENWATCOM_COMPILE_RC_DEPORD =
247define TOOL_OPENWATCOM_COMPILE_RC_CMDS
248 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \
249 $(TOOL_OPENWATCOM_RC) -r\
250 $(flags) \
251 $(addprefix -i=, $(call TOOL_OPENWATCOM_FIX_SLASHES,$(incs))) \
252 $(addprefix -d, $(defs))\
253 -fo=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(obj)) \
254 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(abspath $(source)))
255endef
256
257TOOL_OPENWATCOM_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp
258TOOL_OPENWATCOM_LINK_LIBRARY_DEPEND = $(othersrc)
259TOOL_OPENWATCOM_LINK_LIBRARY_DEPORD =
260define TOOL_OPENWATCOM_LINK_LIBRARY_CMDS
261 $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(call TOOL_OPENWATCOM_FIX_SLASHES,$(objs) $(othersrc)),'+"$(obj)"')
262 $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) @$(outbase).rsp
263endef
264
265TOOL_OPENWATCOM_LINK_PROGRAM_OUTPUT = $(outbase).map
266TOOL_OPENWATCOM_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
267TOOL_OPENWATCOM_LINK_PROGRAM_DEPORD =
268define TOOL_OPENWATCOM_LINK_PROGRAM_CMDS
269 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
270 $(TOOL_OPENWATCOM_LD) \
271 $(flags) \
272 -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
273 -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
274 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
275 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
276 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
277 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
278 $(TOOL_OPENWATCOM_RC) \
279 $(filter -bt=%,$(flags)) \
280 /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
281 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
282endef
283
284TOOL_OPENWATCOM_LINK_DLL_OUTPUT = $(outbase).map
285TOOL_OPENWATCOM_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
286TOOL_OPENWATCOM_LINK_DLL_DEPORD =
287define TOOL_OPENWATCOM_LINK_DLL_CMDS
288 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
289 $(TOOL_OPENWATCOM_LD) \
290 $(flags) \
291 -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
292 -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
293 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
294 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
295 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
296 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
297 $(TOOL_OPENWATCOM_RC) \
298 $(filter -bt=%,$(flags)) \
299 /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
300 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
301endef
302
303TOOL_OPENWATCOM_LINK_SYSMOD_OUTPUT = $(outbase).map
304TOOL_OPENWATCOM_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
305TOOL_OPENWATCOM_LINK_SYSMOD_DEPORD =
306define TOOL_OPENWATCOM_LINK_SYSMOD_CMDS
307 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
308 $(TOOL_OPENWATCOM_LD) \
309 $(flags) \
310 -fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
311 -fm=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(outbase).map) \
312 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter-out %.res,$(objs))) \
313 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(libs)) \
314 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(othersrc))
315 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
316 $(TOOL_OPENWATCOM_RC) \
317 $(filter -bt=%,$(flags)) \
318 /fe=$(call TOOL_OPENWATCOM_FIX_SLASHES,$(out)) \
319 $(call TOOL_OPENWATCOM_FIX_SLASHES,$(filter %.res,$(objs))))
320endef
321
Note: See TracBrowser for help on using the repository browser.