source: trunk/kBuild/tools/GCC3OMF.kmk@ 390

Last change on this file since 390 was 380, checked in by bird, 20 years ago

Big command dependency job. More installation stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.7 KB
Line 
1# $Id: GCC3OMF.kmk 380 2005-12-18 13:52:47Z bird $
2## @file
3#
4# kBuild Tool Config - OS/2 GCC v3 OMF.
5#
6# Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net>
7#
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
27TOOL_GCC3OMF := OS/2 GCC v3 OMF
28
29TOOL_GCC3OMF_CC := gcc$(HOSTSUFF_EXE)
30TOOL_GCC3OMF_COBJSUFF := .o
31TOOL_GCC3OMF_CFLAGS := -g -Zomf
32TOOL_GCC3OMF_CFLAGS.debug := -O0
33TOOL_GCC3OMF_CFLAGS.release := -O2
34TOOL_GCC3OMF_CFLAGS.profile := -O2 #-pg
35TOOL_GCC3OMF_CINCS :=
36TOOL_GCC3OMF_CDEFS :=
37
38TOOL_GCC3OMF_CXX := g++$(HOSTSUFF_EXE)
39TOOL_GCC3OMF_CXXOBJSUFF := .o
40TOOL_GCC3OMF_CXXOBJSUFF := .o
41TOOL_GCC3OMF_CXXFLAGS := -g -Zomf
42TOOL_GCC3OMF_CXXFLAGS.debug := -O0
43TOOL_GCC3OMF_CXXFLAGS.release := -O2
44TOOL_GCC3OMF_CXXFLAGS.profile := -O2 #-pg
45TOOL_GCC3OMF_CXXINCS :=
46TOOL_GCC3OMF_CXXDEFS :=
47
48TOOL_GCC3OMF_AS := emxomfas$(HOSTSUFF_EXE)
49TOOL_GCC3OMF_ASOBJSUFF := .obj
50
51TOOL_GCC3OMF_AR := emxomfar$(HOSTSUFF_EXE)
52TOOL_GCC3OMF_ARFLAGS := cr
53TOOL_GCC3OMF_ARLIBSUFF := .lib
54TOOL_GCC3OMF_AR_IMP := emximp$(HOSTSUFF_EXE)
55
56TOOL_GCC3OMF_LD := g++$(HOSTSUFF_EXE)
57TOOL_GCC3OMF_LD_SYSMOD := emxomfld$(HOSTSUFF_EXE)
58TOOL_GCC3OMF_LDFLAGS := -Zomf
59TOOL_GCC3OMF_LDFLAGS.debug := -g
60TOOL_GCC3OMF_LDFLAGS.release := -s
61ifndef TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET)
62TOOL_GCC3OMF_LDFLAGS.dll := -shared -Zdll
63else
64TOOL_GCC3OMF_LDFLAGS.dll := $(TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET))
65endif
66TOOL_GCC3OMF_LDFLAGS.sysmod := -r
67TOOL_GCC3OMF_LD_MAP = -Zmap=$(1)
68TOOL_GCC3OMF_LD_SYSMOD_MAP = -Zmap=$(1)
69
70ifdef SLKRUNS
71TOOL_GCC3OMF_CC += -fmessage-length=0
72TOOL_GCC3OMF_CXX += -fmessage-length=0
73endif
74
75
76## Compile C source.
77# @param $(target) Normalized main target name.
78# @param $(source) Source filename (relative).
79# @param $(obj) Object file name. This shall be (re)created by the compilation.
80# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
81# @param $(flags) Flags.
82# @param $(defs) Definitions. No -D or something.
83# @param $(incs) Includes. No -I or something.
84# @param $(dirdep) Directory creation dependency.
85# @param $(deps) Other dependencies.
86#
87# @param $(outbase) Output basename (full). Use this for list files and such.
88# @param $(objsuff) Object suffix.
89TOOL_GCC3OMF_COMPILE_C_OUTPUT =
90TOOL_GCC3OMF_COMPILE_C_DEPEND =
91TOOL_GCC3OMF_COMPILE_C_DEPORD =
92define TOOL_GCC3OMF_COMPILE_C_CMDS
93 $(TOOL_GCC3OMF_CC) -c\
94 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
95 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP \
96 -o $(obj)\
97 $(call ABSPATH,$(source))
98endef
99
100
101## Compile C++ source.
102# @param $(target) Normalized main target name.
103# @param $(source) Source filename (relative).
104# @param $(obj) Object file name. This shall be (re)created by the compilation.
105# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
106# @param $(flags) Flags.
107# @param $(defs) Definitions. No -D or something.
108# @param $(incs) Includes. No -I or something.
109# @param $(dirdep) Directory creation dependency.
110# @param $(deps) Other dependencies.
111#
112# @param $(outbase) Output basename (full). Use this for list files and such.
113# @param $(objsuff) Object suffix.
114TOOL_GCC3OMF_COMPILE_CXX_OUTPUT =
115TOOL_GCC3OMF_COMPILE_CXX_DEPEND =
116TOOL_GCC3OMF_COMPILE_CXX_DEPORD =
117define TOOL_GCC3OMF_COMPILE_CXX_CMDS
118 $(TOOL_GCC3OMF_CXX) -c\
119 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
120 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP \
121 -o $(obj)\
122 $(call ABSPATH,$(source))
123endef
124
125
126## Link library
127# @param $(target) Normalized main target name.
128# @param $(out) Library name.
129# @param $(objs) Object files to put in the library.
130# @param $(flags) Flags.
131# @param $(dirdep) Directory creation dependency.
132# @param $(deps) Other dependencies.
133# @param $(othersrc) Unhandled sources.
134#
135# @param $(outbase) Output basename (full). Use this for list files and such.
136TOOL_GCC3OMF_LINK_LIBRARY_OUTPUT =
137TOOL_GCC3OMF_LINK_LIBRARY_DEPEND = $(filter %.a %.lib %.def %.imp,$(othersrc))
138TOOL_GCC3OMF_LINK_LIBRARY_DEPORD =
139define TOOL_GCC3OMF_LINK_LIBRARY_CMDS
140 $(if $(filter %.def %.imp,$(othersrc)),$(TOOL_GCC3OMF_AR_IMP) -o $(out) $(filter %.def %.imp,$(othersrc)),)
141 $(TOOL_GCC3OMF_AR) $(flags) $(out) $(objs) $(filter %.a %.lib,$(othersrc))
142endef
143
144
145## Link program
146# @param $(target) Normalized main target name.
147# @param $(out) Program name.
148# @param $(objs) Object files to link together.
149# @param $(libs) Libraries to search.
150# @param $(libpath) Library search paths.
151# @param $(flags) Flags.
152# @param $(dirdep) Directory creation dependency.
153# @param $(deps) Other dependencies.
154# @param $(othersrc) Unhandled sources.
155# @param $(custom_pre) Custom step invoked before linking.
156# @param $(custom_post) Custom step invoked after linking.
157#
158# @param $(outbase) Output basename (full). Use this for list files and such.
159TOOL_GCC3OMF_LINK_PROGRAM_OUTPUT = $(outbase).map
160TOOL_GCC3OMF_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
161 $(filter %.def, $(othersrc))
162TOOL_GCC3OMF_LINK_PROGRAM_DEPORD =
163define TOOL_GCC3OMF_LINK_PROGRAM_CMDS
164 $(TOOL_GCC3OMF_LD) $(flags) -o $(out) $(objs)\
165 $(filter %.def, $(othersrc))\
166 $(foreach p,$(libpath), -L$(p))\
167 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
168 $(call TOOL_GCC3_LD_MAP,$(outbase).map)
169endef
170
171
172## Link DLL
173# @param $(target) Normalized main target name.
174# @param $(out) Program name.
175# @param $(objs) Object files to link together.
176# @param $(libs) Libraries to search.
177# @param $(libpath) Library search paths.
178# @param $(flags) Flags.
179# @param $(dirdep) Directory creation dependency.
180# @param $(deps) Other dependencies.
181# @param $(othersrc) Unhandled sources.
182# @param $(custom_pre) Custom step invoked before linking.
183# @param $(custom_post) Custom step invoked after linking.
184#
185# @param $(outbase) Output basename (full). Use this for list files and such.
186TOOL_GCC3OMF_LINK_DLL_OUTPUT = $(outbase).map
187TOOL_GCC3OMF_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
188 $(filter %.def, $(othersrc))
189TOOL_GCC3OMF_LINK_DLL_DEPORD =
190define TOOL_GCC3OMF_LINK_DLL_CMDS
191 $(TOOL_GCC3OMF_LD) $(TOOL_GCC3OMF_LDFLAGS.dll) $(flags) -o $(out) $(objs)\
192 $(filter %.def, $(othersrc))\
193 $(foreach p,$(libpath), -L$(p))\
194 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
195 $(call TOOL_GCC3_LD_MAP,$(outbase).map)
196endef
197
198## Link system module (windows aka driver, linux aka kernel module)
199# @param $(target) Normalized main target name.
200# @param $(out) System module name.
201# @param $(objs) Object files to link together.
202# @param $(libs) Libraries to search.
203# @param $(libpath) Library search paths.
204# @param $(flags) Flags.
205# @param $(dirdep) Directory creation dependency.
206# @param $(deps) Other dependencies.
207# @param $(othersrc) Unhandled sources.
208# @param $(custom_pre) Custom step invoked before linking.
209# @param $(custom_post) Custom step invoked after linking.
210#
211# @param $(outbase) Output basename (full). Use this for list files and such.
212TOOL_GCC3OMF_LINK_SYSMOD_OUTPUT = $(outbase).map
213TOOL_GCC3OMF_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
214 $(filter %.def, $(othersrc))
215TOOL_GCC3OMF_LINK_SYSMOD_DEPORD =
216define TOOL_GCC3OMF_LINK_SYSMOD_CMDS
217 $(TOOL_GCC3OMF_LD_SYSMOD) $(TOOL_GCC3OMF_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
218 $(filter %.def, $(othersrc))\
219 $(foreach p,$(libpath), -L$(p))\
220 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
221 $(call TOOL_GCC3_LD_SYSMOD_MAP,$(outbase).map)
222endef
223
Note: See TracBrowser for help on using the repository browser.