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

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

tools/OPENWATCOM*: Assembler fix. Only windows and os/2 needs the slashes switched.

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