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

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

Watcom librarian commands.

  • 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 2069 2008-11-17 02:27:44Z 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 'PATH=$(PATH_TOOL_OPENWATCOM_BIN)' \
61 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
62 -E 'LIB=$1' \
63 -E 'INCLUDE=' \
64 --
65 else
66 PATH_TOOL_OPENWATCOM_BIN = $(PATH_TOOL_OPENWATCOM)/binnt
67 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
68 -E 'PATH=$(PATH_TOOL_OPENWATCOM_BIN)' \
69 -E 'WATCOM=$(PATH_TOOL_OPENWATCOM)' \
70 -E 'LIB=$1' \
71 -E 'INCLUDE=' \
72 --
73 endif
74
75 TOOL_OPENWATCOM_CC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc386$(HOSTSUFF_EXE)
76 TOOL_OPENWATCOM_CC16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcc$(HOSTSUFF_EXE)
77 TOOL_OPENWATCOM_CXX ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp386$(HOSTSUFF_EXE)
78 TOOL_OPENWATCOM_CXX16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wpp$(HOSTSUFF_EXE)
79 TOOL_OPENWATCOM_AS ?= $(PATH_TOOL_OPENWATCOM_BIN)/wasm$(HOSTSUFF_EXE)
80 TOOL_OPENWATCOM_AR ?= $(PATH_TOOL_OPENWATCOM_BIN)/wlib$(HOSTSUFF_EXE)
81 TOOL_OPENWATCOM_LD ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl386$(HOSTSUFF_EXE)
82 TOOL_OPENWATCOM_LD16 ?= $(PATH_TOOL_OPENWATCOM_BIN)/wcl$(HOSTSUFF_EXE)
83 TOOL_OPENWATCOM_RC ?= $(PATH_TOOL_OPENWATCOM_BIN)/wrc$(HOSTSUFF_EXE)
84
85else
86 # Pathless, relies on the environment.
87 TOOL_OPENWATCOM_PATHLESS :=
88 TOOL_OPENWATCOM_ENV_SETUP ?= $(REDIRECT) \
89 -E 'LIB=$1' \
90 -E 'INCLUDE=' \
91 --
92 TOOL_OPENWATCOM_CC ?= wcc386$(HOSTSUFF_EXE)
93 TOOL_OPENWATCOM_CC16 ?= wcc$(HOSTSUFF_EXE)
94 TOOL_OPENWATCOM_CXX ?= wpp386$(HOSTSUFF_EXE)
95 TOOL_OPENWATCOM_CXX16 ?= wpp$(HOSTSUFF_EXE)
96 TOOL_OPENWATCOM_AS ?= wasm$(HOSTSUFF_EXE)
97 TOOL_OPENWATCOM_AR ?= wlib$(HOSTSUFF_EXE)
98 TOOL_OPENWATCOM_LD ?= wcl386$(HOSTSUFF_EXE)
99 TOOL_OPENWATCOM_LD16 ?= wcl$(HOSTSUFF_EXE)
100 TOOL_OPENWATCOM_RC ?= wrc$(HOSTSUFF_EXE)
101
102endif
103
104# General Properties used by kBuild
105TOOL_OPENWATCOM_ASOBJSUFF ?= .obj
106TOOL_OPENWATCOM_ASFLAGS ?= -zq
107TOOL_OPENWATCOM_ASFLAGS.os2 ?= -bt=os2
108TOOL_OPENWATCOM_ASFLAGS.win ?= -bt=nt
109
110TOOL_OPENWATCOM_COBJSUFF ?= .obj
111TOOL_OPENWATCOM_CFLAGS ?= -zq
112TOOL_OPENWATCOM_CFLAGS.os2 ?= -bt=os2
113TOOL_OPENWATCOM_CFLAGS.win ?= -bt=nt
114TOOL_OPENWATCOM_CINCS ?= $(PATH_TOOL_OPENWATCOM)/h
115
116TOOL_OPENWATCOM_CXXOBJSUFF ?= .obj
117TOOL_OPENWATCOM_CXXFLAGS ?= -zq
118TOOL_OPENWATCOM_CXXFLAGS.os2 ?= -bt=os2
119TOOL_OPENWATCOM_CXXFLAGS.win ?= -bt=nt
120TOOL_OPENWATCOM_CXXINCS ?= $(PATH_TOOL_OPENWATCOM)/h
121
122TOOL_OPENWATCOM_RCOBJSUFF ?= .res
123TOOL_OPENWATCOM_RCFLAGS ?= -r
124TOOL_OPENWATCOM_RCFLAGS.os2 ?= -bt=os2
125TOOL_OPENWATCOM_RCFLAGS.win ?= -bt=nt
126TOOL_OPENWATCOM_RCINCS ?= $(PATH_TOOL_OPENWATCOM)/h
127
128TOOL_OPENWATCOM_ARFLAGS ?=
129TOOL_OPENWATCOM_ARLIBSUFF ?= .lib
130
131TOOL_OPENWATCOM_LDFLAGS ?= -zq -y
132TOOL_OPENWATCOM_LDFLAGS.os2 ?= -bt=os2
133TOOL_OPENWATCOM_LDFLAGS.win ?= -bt=nt
134
135
136TOOL_OPENWATCOM_COMPILE_AS_DEPEND =
137TOOL_OPENWATCOM_COMPILE_AS_DEPORD =
138TOOL_OPENWATCOM_COMPILE_AS_OUTPUT = $(obj).err
139define TOOL_OPENWATCOM_COMPILE_AS_CMDS
140 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AS) \
141 $(flags) \
142 $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
143 $(addprefix -d, $(defs)) \
144 -fo=$(subst /,\\,$(obj)) \
145 -fr=$(subst /,\\,$(obj)).err \
146 $(subst /,\\,$(abspath $(source)))
147 $(QUIET)$(APPEND) -n $(obj).err
148## @todo dependencies
149endef
150
151
152TOOL_OPENWATCOM_COMPILE_C_DEPEND =
153TOOL_OPENWATCOM_COMPILE_C_DEPORD =
154TOOL_OPENWATCOM_COMPILE_C_OUTPUT = $(obj).err
155define TOOL_OPENWATCOM_COMPILE_C_CMDS
156 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CC) \
157 $(flags) \
158 $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
159 $(addprefix -d, $(defs)) \
160 -fo=$(subst /,\\,$(obj)) \
161 -fr=$(subst /,\\,$(obj)).err \
162 $(subst /,\\,$(abspath $(source)))
163 $(QUIET)$(APPEND) -n $(obj).err
164## @todo dependencies
165endef
166
167TOOL_OPENWATCOM_COMPILE_CXX_DEPEND =
168TOOL_OPENWATCOM_COMPILE_CXX_DEPORD =
169TOOL_OPENWATCOM_COMPILE_CXX_OUTPUT = $(obj).err
170define TOOL_OPENWATCOM_COMPILE_CXX_CMDS
171 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_CXX) \
172 $(flags) \
173 $(addsuffix , $(addprefix -i=, $(subst /,\\,$(incs)))) \
174 $(addprefix -d, $(defs)) \
175 -fo=$(subst /,\\,$(obj)) \
176 -fr=$(subst /,\\,$(obj)).err \
177 $(subst /,\\,$(abspath $(source)))
178 $(QUIET)$(APPEND) -n $(obj).err
179## @todo dependencies
180endef
181
182TOOL_OPENWATCOM_COMPILE_RC_OUTPUT =
183TOOL_OPENWATCOM_COMPILE_RC_DEPEND =
184TOOL_OPENWATCOM_COMPILE_RC_DEPORD =
185define TOOL_OPENWATCOM_COMPILE_RC_CMDS
186 $(QUIET) $(call TOOL_OPENWATCOM_ENV_SETUP) \
187 $(TOOL_OPENWATCOM_RC) -r\
188 $(flags) \
189 $(addprefix -i=, $(subst /,\\,$(incs))) \
190 $(addprefix -d, $(defs))\
191 -fo=$(subst /,\\,obj) \
192 $(subst /,\\,$(abspath $(source)))
193endef
194
195TOOL_OPENWATCOM_LINK_LIBRARY_OUTPUT = ## @todo $(outbase).rsp
196TOOL_OPENWATCOM_LINK_LIBRARY_DEPEND = $(othersrc)
197TOOL_OPENWATCOM_LINK_LIBRARY_DEPORD =
198define TOOL_OPENWATCOM_LINK_LIBRARY_CMDS
199 $(QUIET)$(APPEND) -tn $(outbase).rsp $(foreach obj,$(subst /,\,$(objs) $(othersrc)),'+"$(obj)"')
200 $(QUIET)$(TOOL_OPENWATCOM_ENV_SETUP) $(TOOL_OPENWATCOM_AR) $(flags) $(subst /,\\,$(out)) @$(outbase).rsp
201endef
202
203TOOL_OPENWATCOM_LINK_PROGRAM_OUTPUT = $(outbase).map
204TOOL_OPENWATCOM_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
205TOOL_OPENWATCOM_LINK_PROGRAM_DEPORD =
206define TOOL_OPENWATCOM_LINK_PROGRAM_CMDS
207 $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP,$(subst $(SP),,$(addsuffix ;,$(libpath)))) \
208 $(TOOL_OPENWATCOM_LD) \
209 $(flags) \
210 -fe=$(subst /,\\,$(out)) \
211 -fm=$(subst /,\\,$(outbase).map) \
212 $(subst /,\\,$(filter-out %.res,$(objs))) \
213 $(subst /,\\,$(libs)) \
214 $(subst /,\\,$(othersrc))
215 $(if $(filter %.res,$(objs)), $(QUIET)$(call TOOL_OPENWATCOM_ENV_SETUP) \
216 $(TOOL_OPENWATCOM_RC) \
217 $(filter -bt=%,$(flags)) \
218 /fe=$(subst /,\\,$(out)) \
219 $(subst /,\\,$(filter %.res,$(objs))))
220endef
221
222TOOL_OPENWATCOM_LINK_DLL_OUTPUT = $(outbase).map
223TOOL_OPENWATCOM_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
224TOOL_OPENWATCOM_LINK_DLL_DEPORD =
225define TOOL_OPENWATCOM_LINK_DLL_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_SYSMOD_OUTPUT = $(outbase).map
242TOOL_OPENWATCOM_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
243TOOL_OPENWATCOM_LINK_SYSMOD_DEPORD =
244define TOOL_OPENWATCOM_LINK_SYSMOD_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
Note: See TracBrowser for help on using the repository browser.