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

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

dirdep is order prereq only and not something causing anything else to build.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.5 KB
Line 
1# $Id: GCC3OMF.kmk 235 2005-02-10 22:38:52Z bird $
2## @file
3#
4# kBuild Tool Config - OS/2 GCC v3 OMF.
5#
6# Copyright (c) 2004 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
54
55TOOL_GCC3OMF_LD := g++$(HOSTSUFF_EXE)
56TOOL_GCC3OMF_LD_SYSMOD := emxomfld$(HOSTSUFF_EXE)
57TOOL_GCC3OMF_LDFLAGS := -Zomf
58TOOL_GCC3OMF_LDFLAGS.debug := -g
59TOOL_GCC3OMF_LDFLAGS.release := -s
60ifndef TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET)
61TOOL_GCC3OMF_LDFLAGS.dll := -shared -Zdll
62else
63TOOL_GCC3OMF_LDFLAGS.dll := $(TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET))
64endif
65TOOL_GCC3OMF_LDFLAGS.sysmod := -r
66
67ifdef SLKRUNS
68TOOL_GCC3OMF_CC += -fmessage-length=0
69TOOL_GCC3OMF_CXX += -fmessage-length=0
70endif
71
72
73## Compile C source.
74# @param $(target) Normalized main target name.
75# @param $(source) Source filename (relative).
76# @param $(obj) Object file name. This shall be (re)created by the compilation.
77# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
78# @param $(flags) Flags.
79# @param $(defs) Definitions. No -D or something.
80# @param $(incs) Includes. No -I or something.
81# @param $(dirdep) Directory creation dependency.
82# @param $(deps) Other dependencies.
83#
84# @param $(outbase) Output basename (full). Use this for list files and such.
85# @param $(objsuff) Object suffix.
86define TOOL_GCC3OMF_COMPILE_C
87#$ (warning dbg: TOOL_GCC3OMF_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps))
88$(obj): $(source) $(deps) | $(dirdep)
89 $(call MSG_L2,Compiling $$@ using GCC3)
90 $(TOOL_GCC3OMF_CC) -c\
91 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
92 -Wp,-MD,$(dep) -Wp,-MT,$$@ \
93 -o $$@\
94 $(call ABSPATH,$(source))
95
96endef
97
98
99## Compile C++ source.
100# @param $(target) Normalized main target name.
101# @param $(source) Source filename (relative).
102# @param $(obj) Object file name. This shall be (re)created by the compilation.
103# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
104# @param $(flags) Flags.
105# @param $(defs) Definitions. No -D or something.
106# @param $(incs) Includes. No -I or something.
107# @param $(dirdep) Directory creation dependency.
108# @param $(deps) Other dependencies.
109#
110# @param $(outbase) Output basename (full). Use this for list files and such.
111# @param $(objsuff) Object suffix.
112define TOOL_GCC3OMF_COMPILE_CXX
113#$ (warning dbg: TOOL_GCC3OMF_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps))
114$(obj): $(source) $(deps) | $(dirdep)
115 $(call MSG_L2,Compiling $$@ using GCC3)
116 $(TOOL_GCC3OMF_CXX) -c\
117 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
118 -Wp,-MD,$(dep) -Wp,-MT,$$@ \
119 -o $$@\
120 $(call ABSPATH,$(source))
121
122endef
123
124
125## Link library
126# @param $(target) Normalized main target name.
127# @param $(lib) Library name.
128# @param $(objs) Object files to put in the library.
129# @param $(flags) Flags.
130# @param $(dirdep) Directory creation dependency.
131# @param $(deps) Other dependencies.
132# @param $(othersrc) Unhandled sources.
133#
134# @param $(outbase) Output basename (full). Use this for list files and such.
135define TOOL_GCC3OMF_LINK_LIBRARY
136#$ (warning dbg: TOOL_GCC3OMF_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
137$(lib): $(objs) $(deps) $(filter %.a %.lib,$(othersrc)) | $(dirdep)
138 $(call MSG_L1,Creating Library $$@)
139 $(RM) -f $$@
140 $(TOOL_GCC3OMF_AR) $(flags) $$@ $(objs) $(filter %.a %.lib,$(othersrc))
141
142endef
143
144
145## Link program
146# @param $(target) Normalized main target name.
147# @param $(exe) 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.
159define TOOL_GCC3OMF_LINK_PROGRAM
160#$ (warning dbg: TOOL_GCC3OMF_LINK_PROGRAM: target=$(target) exe=$(exe) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
161$(exe): $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def, $(othersrc)) | $(dirdep)
162 $(call MSG_L1,Creating Program $$@)
163ifneq ($(custom_pre),)
164 $(eval $(custom_pre))
165endif
166 $(TOOL_GCC3OMF_LD) $(flags) -o $$@ $(objs) \
167 $(filter %.def, $(othersrc)) \
168 $(foreach p,$(libpath), -L$(p)) \
169 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
170ifneq ($(custom_post),)
171 $(eval $(custom_post))
172endif
173
174endef
175
176
177## Link DLL
178# @param $(target) Normalized main target name.
179# @param $(dll) Program name.
180# @param $(objs) Object files to link together.
181# @param $(libs) Libraries to search.
182# @param $(libpath) Library search paths.
183# @param $(flags) Flags.
184# @param $(dirdep) Directory creation dependency.
185# @param $(deps) Other dependencies.
186# @param $(othersrc) Unhandled sources.
187# @param $(custom_pre) Custom step invoked before linking.
188# @param $(custom_post) Custom step invoked after linking.
189#
190# @param $(outbase) Output basename (full). Use this for list files and such.
191define TOOL_GCC3OMF_LINK_DLL
192#$ (warning dbg: TOOL_GCC3OMF_LINK_PROGRAM: target=$(target) dll=$(dll) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
193$(dll): $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def, $(othersrc)) | $(dirdep)
194 $(call MSG_L1,Creating Program $$@)
195ifneq ($(custom_pre),)
196 $(eval $(custom_pre))
197endif
198 $(TOOL_GCC3OMF_LD) $(TOOL_GCC3OMF_LDFLAGS.dll) $(flags) -o $$@ $(objs) \
199 $(filter %.def, $(othersrc)) \
200 $(foreach p,$(libpath), -L$(p)) \
201 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
202ifneq ($(custom_post),)
203 $(eval $(custom_post))
204endif
205
206endef
207
208## Link system module (windows aka driver, linux aka kernel module)
209# @param $(target) Normalized main target name.
210# @param $(sys) System module name.
211# @param $(objs) Object files to link together.
212# @param $(libs) Libraries to search.
213# @param $(libpath) Library search paths.
214# @param $(flags) Flags.
215# @param $(dirdep) Directory creation dependency.
216# @param $(deps) Other dependencies.
217# @param $(othersrc) Unhandled sources.
218# @param $(custom_pre) Custom step invoked before linking.
219# @param $(custom_post) Custom step invoked after linking.
220#
221# @param $(outbase) Output basename (full). Use this for list files and such.
222define TOOL_GCC3OMF_LINK_SYSMOD
223#$ (warning dbg: TOOL_GCC3OMF_LINK_SYSMOD: target=$(target) sys=$(sys) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
224$(sys): $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) $(filter %.def, $(othersrc)) | $(dirdep)
225 $(call MSG_L1,Creating Program $$@)
226ifneq ($(custom_pre),)
227 $(eval $(custom_pre))
228endif
229 $(TOOL_GCC3OMF_LD_SYSMOD) $(TOOL_GCC3OMF_LDFLAGS.sysmod) $(flags) -o $$@ $(objs) \
230 $(filter %.def, $(othersrc)) \
231 $(foreach p,$(libpath), -L$(p)) \
232 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
233ifneq ($(custom_post),)
234 $(eval $(custom_post))
235endif
236
237endef
238
Note: See TracBrowser for help on using the repository browser.