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

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

Shut up the watcom librarian and use strict libpath so it's possible to use different watcom versions simulatiously.

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