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

Last change on this file since 2081 was 2081, checked in by bird, 17 years ago

spaces

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