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

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

new watcom and open watcom location.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.3 KB
Line 
1# $Id: OPENWATCOM.kmk 2075 2008-11-18 00:12:18Z 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 if1of ($(USER) $(USERNAME) $(LOGNAME), bird)
47 PATH_TOOL_OPENWATCOM := $(wildcard d:/dev/Watcom/v1.*)
48 endif
49 PATH_TOOL_OPENWATCOM := $(firstword $(sort $(PATH_TOOL_OPENWATCOM)))
50 # if not found, we'll enter 'pathless' mode.
51else
52 # Resolve any fancy stuff once and for all.
53 PATH_TOOL_OPENWATCOM := $(PATH_TOOL_OPENWATCOM)
54endif
55
56ifneq ($(PATH_TOOL_OPENWATCOM),)
57 TOOL_OPENWATCOM_PATHLESS := no
58
59 ifeq ($(KBUILD_HOST),os2)
60 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binp
61 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
62 -E 'BEGINLIBPATH=$(PATH_TOOL_OPENWATCOM)/binp/dll;$(BEGINLIBPATH)' \
63 -E 'LIBPATHSTRICT=T' \
64 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN)' \
65 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
66 -E 'LIB=$1' \
67 -E 'INCLUDE=' \
68 --
69 else
70 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binnt
71 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
72 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN)' \
73 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
74 -E 'LIB=$1' \
75 -E 'INCLUDE=' \
76 --
77 endif
78
79 TOOL_OPENWATCOM_CC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc386$(HOSTSUFF_EXE)
80 TOOL_OPENWATCOM_CC16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc$(HOSTSUFF_EXE)
81 TOOL_OPENWATCOM_CXX ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp386$(HOSTSUFF_EXE)
82 TOOL_OPENWATCOM_CXX16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp$(HOSTSUFF_EXE)
83 TOOL_OPENWATCOM_AS ?= $(PATH_TOOL_OPENWATCOM_BIN)/wasm$(HOSTSUFF_EXE)
84 TOOL_OPENWATCOM_AR ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlib$(HOSTSUFF_EXE)
85 TOOL_OPENWATCOM_LD ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl386$(HOSTSUFF_EXE)
86 TOOL_OPENWATCOM_LD16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl$(HOSTSUFF_EXE)
87 TOOL_OPENWATCOM_RC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wrc$(HOSTSUFF_EXE)
88
89else
90 # Pathless, relies on the environment.
91 TOOL_OPENWATCOM_PATHLESS :=
92 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
93 -E 'LIB=$1' \
94 -E 'INCLUDE=' \
95 --
96 TOOL_OPENWATCOM_CC ?= wcc386$(HOSTSUFF_EXE)
97 TOOL_OPENWATCOM_CC16 ?= wcc$(HOSTSUFF_EXE)
98 TOOL_OPENWATCOM_CXX ?= wpp386$(HOSTSUFF_EXE)
99 TOOL_OPENWATCOM_CXX16 ?= wpp$(HOSTSUFF_EXE)
100 TOOL_OPENWATCOM_AS ?= wasm$(HOSTSUFF_EXE)
101 TOOL_OPENWATCOM_AR ?= wlib$(HOSTSUFF_EXE)
102 TOOL_OPENWATCOM_LD ?= wcl386$(HOSTSUFF_EXE)
103 TOOL_OPENWATCOM_LD16 ?= wcl$(HOSTSUFF_EXE)
104 TOOL_OPENWATCOM_RC ?= wrc$(HOSTSUFF_EXE)
105
106endif
107
108# General Properties used by kBuild
109TOOL_OPENWATCOM_ASOBJSUFF ?= .obj
110TOOL_OPENWATCOM_ASFLAGS ?= -zq
111TOOL_OPENWATCOM_ASFLAGS.os2 ?= -bt=os2
112TOOL_OPENWATCOM_ASFLAGS.win ?= -bt=nt
113
114TOOL_OPENWATCOM_COBJSUFF ?= .obj
115TOOL_OPENWATCOM_CFLAGS ?= -zq
116TOOL_OPENWATCOM_CFLAGS.os2 ?= -bt=os2
117TOOL_OPENWATCOM_CFLAGS.win ?= -bt=nt
118TOOL_OPENWATCOM_CINCS ?= $(PATH_TOOL_OPENWATCOM)/h
119
120TOOL_OPENWATCOM_CXXOBJSUFF ?= .obj
121TOOL_OPENWATCOM_CXXFLAGS ?= -zq
122TOOL_OPENWATCOM_CXXFLAGS.os2 ?= -bt=os2
123TOOL_OPENWATCOM_CXXFLAGS.win ?= -bt=nt
124TOOL_OPENWATCOM_CXXINCS ?= $(PATH_TOOL_OPENWATCOM)/h
125
126TOOL_OPENWATCOM_RCOBJSUFF ?= .res
127TOOL_OPENWATCOM_RCFLAGS ?= -r
128TOOL_OPENWATCOM_RCFLAGS.os2 ?= -bt=os2
129TOOL_OPENWATCOM_RCFLAGS.win ?= -bt=nt
130TOOL_OPENWATCOM_RCINCS ?= $(PATH_TOOL_OPENWATCOM)/h
131
132TOOL_OPENWATCOM_ARFLAGS ?= -q
133TOOL_OPENWATCOM_ARLIBSUFF ?= .lib
134
135TOOL_OPENWATCOM_LDFLAGS ?= -zq -y
136TOOL_OPENWATCOM_LDFLAGS.os2 ?= -bt=os2
137TOOL_OPENWATCOM_LDFLAGS.win ?= -bt=nt
138
139
140TOOL_OPENWATCOM_COMPILE_AS_DEPEND =
141TOOL_OPENWATCOM_COMPILE_AS_DEPORD =
142TOOL_OPENWATCOM_COMPILE_AS_OUTPUT = $(obj).err
143define TOOL_OPENWATCOM_COMPILE_AS_CMDS
144 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AS) \
145 $(flags) \
146 $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
147 $(addprefix -d, $(defs)) \
148 -fo=$(subst /,\\,$(obj)) \
149 -fr=$(subst /,\\,$(obj)).err \
150 $(subst /,\\,$(abspath $(source)))
151 $(QUIET)$(APPEND) -n $(obj).err
152## @todo dependencies
153endef
154
155
156TOOL_OPENWATCOM_COMPILE_C_DEPEND =
157TOOL_OPENWATCOM_COMPILE_C_DEPORD =
158TOOL_OPENWATCOM_COMPILE_C_OUTPUT = $(obj).err
159define TOOL_OPENWATCOM_COMPILE_C_CMDS
160 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC) \
161 $(flags) \
162 $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
163 $(addprefix -d, $(defs)) \
164 -fo=$(subst /,\\,$(obj)) \
165 -fr=$(subst /,\\,$(obj)).err \
166 $(subst /,\\,$(abspath $(source)))
167 $(QUIET)$(APPEND) -n $(obj).err
168## @todo dependencies
169endef
170
171TOOL_OPENWATCOM_COMPILE_CXX_DEPEND =
172TOOL_OPENWATCOM_COMPILE_CXX_DEPORD =
173TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT = $(obj).err
174define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
175 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CXX) \
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_RC_OUTPUT =
187TOOL_OPENWATCOM_COMPILE_RC_DEPEND =
188TOOL_OPENWATCOM_COMPILE_RC_DEPORD =
189define TOOL_OPENWATCOM_COMPILE_RC_CMDS
190 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \
191 $(TOOL_OPENWATCOM_RC) -r\
192 $(flags) \
193 $(addprefix -i=, $(subst /,\\,$(incs))) \
194 $(addprefix -d, $(defs))\
195 -fo=$(subst /,\\,obj) \
196 $(subst /,\\,$(abspath $(source)))
197endef
198
199TOOL_OPENWATCOM_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp
200TOOL_OPENWATCOM_LINK_LIBRARY_DEPEND = $(othersrc)
201TOOL_OPENWATCOM_LINK_LIBRARY_DEPORD =
202define TOOL_OPENWATCOM_LINK_LIBRARY_CMDS
203 $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(subst /,\,$(objs) $(othersrc)),'+"$(obj)"')
204 $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(subst /,\\,$(out)) @$(outbase).rsp
205endef
206
207TOOL_OPENWATCOM_LINK_PROGRAM_OUTPUT = $(outbase).map
208TOOL_OPENWATCOM_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
209TOOL_OPENWATCOM_LINK_PROGRAM_DEPORD =
210define TOOL_OPENWATCOM_LINK_PROGRAM_CMDS
211 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
212 $(TOOL_OPENWATCOM_LD) \
213 $(flags) \
214 -fe=$(subst /,\\,$(out)) \
215 -fm=$(subst /,\\,$(outbase).map) \
216 $(subst /,\\,$(filter-out %.res,$(objs))) \
217 $(subst /,\\,$(libs)) \
218 $(subst /,\\,$(othersrc))
219 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
220 $(TOOL_OPENWATCOM_RC) \
221 $(filter -bt=%,$(flags)) \
222 /fe=$(subst /,\\,$(out)) \
223 $(subst /,\\,$(filter %.res,$(objs))))
224endef
225
226TOOL_OPENWATCOM_LINK_DLL_OUTPUT = $(outbase).map
227TOOL_OPENWATCOM_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
228TOOL_OPENWATCOM_LINK_DLL_DEPORD =
229define TOOL_OPENWATCOM_LINK_DLL_CMDS
230 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
231 $(TOOL_OPENWATCOM_LD) \
232 $(flags) \
233 -fe=$(subst /,\\,$(out)) \
234 -fm=$(subst /,\\,$(outbase).map) \
235 $(subst /,\\,$(filter-out %.res,$(objs))) \
236 $(subst /,\\,$(libs)) \
237 $(subst /,\\,$(othersrc))
238 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
239 $(TOOL_OPENWATCOM_RC) \
240 $(filter -bt=%,$(flags)) \
241 /fe=$(subst /,\\,$(out)) \
242 $(subst /,\\,$(filter %.res,$(objs))))
243endef
244
245TOOL_OPENWATCOM_LINK_SYSMOD_OUTPUT = $(outbase).map
246TOOL_OPENWATCOM_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
247TOOL_OPENWATCOM_LINK_SYSMOD_DEPORD =
248define TOOL_OPENWATCOM_LINK_SYSMOD_CMDS
249 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
250 $(TOOL_OPENWATCOM_LD) \
251 $(flags) \
252 -fe=$(subst /,\\,$(out)) \
253 -fm=$(subst /,\\,$(outbase).map) \
254 $(subst /,\\,$(filter-out %.res,$(objs))) \
255 $(subst /,\\,$(libs)) \
256 $(subst /,\\,$(othersrc))
257 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
258 $(TOOL_OPENWATCOM_RC) \
259 $(filter -bt=%,$(flags)) \
260 /fe=$(subst /,\\,$(out)) \
261 $(subst /,\\,$(filter %.res,$(objs))))
262endef
263
Note: See TracBrowser for help on using the repository browser.