1 | # $Id: GCC3OMF.kmk 186 2004-12-12 06:06:35Z 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 |
|
---|
27 | TOOL_GCC3OMF := OS/2 GCC v3 OMF
|
---|
28 |
|
---|
29 | TOOL_GCC3OMF_CC := gcc$(HOSTSUFF_EXE)
|
---|
30 | TOOL_GCC3OMF_COBJSUFF := .o
|
---|
31 | TOOL_GCC3OMF_CFLAGS := -g -Zomf
|
---|
32 | TOOL_GCC3OMF_CFLAGS.debug := -O0
|
---|
33 | TOOL_GCC3OMF_CFLAGS.release := -O2
|
---|
34 | TOOL_GCC3OMF_CFLAGS.profile := -O2 #-pg
|
---|
35 | TOOL_GCC3OMF_CINCS :=
|
---|
36 | TOOL_GCC3OMF_CDEFS :=
|
---|
37 |
|
---|
38 | TOOL_GCC3OMF_CXX := g++$(HOSTSUFF_EXE)
|
---|
39 | TOOL_GCC3OMF_CXXOBJSUFF := .o
|
---|
40 | TOOL_GCC3OMF_CXXOBJSUFF := .o
|
---|
41 | TOOL_GCC3OMF_CXXFLAGS := -g -Zomf
|
---|
42 | TOOL_GCC3OMF_CXXFLAGS.debug := -O0
|
---|
43 | TOOL_GCC3OMF_CXXFLAGS.release := -O2
|
---|
44 | TOOL_GCC3OMF_CXXFLAGS.profile := -O2 #-pg
|
---|
45 | TOOL_GCC3OMF_CXXINCS :=
|
---|
46 | TOOL_GCC3OMF_CXXDEFS :=
|
---|
47 |
|
---|
48 | TOOL_GCC3OMF_AS := emxomfas$(HOSTSUFF_EXE)
|
---|
49 | TOOL_GCC3OMF_ASOBJSUFF := .obj
|
---|
50 |
|
---|
51 | TOOL_GCC3OMF_AR := emxomfar$(HOSTSUFF_EXE)
|
---|
52 | TOOL_GCC3OMF_ARFLAGS := cr
|
---|
53 | TOOL_GCC3OMF_ARLIBSUFF := .lib
|
---|
54 |
|
---|
55 | TOOL_GCC3OMF_LD := g++$(HOSTSUFF_EXE)
|
---|
56 | TOOL_GCC3OMF_LD_SYSMOD := emxomfld$(HOSTSUFF_EXE)
|
---|
57 | TOOL_GCC3OMF_LDFLAGS := -Zomf
|
---|
58 | TOOL_GCC3OMF_LDFLAGS.debug := -g
|
---|
59 | TOOL_GCC3OMF_LDFLAGS.release := -s
|
---|
60 | ifndef TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET)
|
---|
61 | TOOL_GCC3OMF_LDFLAGS.dll := -shared -Zdll
|
---|
62 | else
|
---|
63 | TOOL_GCC3OMF_LDFLAGS.dll := $(TOOL_GCC3OMF_LDFLAGS.$(BUILD_TARGET))
|
---|
64 | endif
|
---|
65 | TOOL_GCC3OMF_LDFLAGS.sysmod := -r
|
---|
66 |
|
---|
67 | ifdef SLKRUNS
|
---|
68 | TOOL_GCC3OMF_CC += -fmessage-length=0
|
---|
69 | TOOL_GCC3OMF_CXX += -fmessage-length=0
|
---|
70 | endif
|
---|
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.
|
---|
86 | define 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): $(dirdep) $(source) $(deps)
|
---|
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 |
|
---|
96 | endef
|
---|
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.
|
---|
112 | define 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): $(dirdep) $(source) $(deps)
|
---|
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 |
|
---|
122 | endef
|
---|
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 | #
|
---|
133 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
134 | define TOOL_GCC3OMF_LINK_LIBRARY
|
---|
135 | #$ (warning dbg: TOOL_GCC3OMF_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase))
|
---|
136 | $(lib): $(dirdep) $(objs) $(deps)
|
---|
137 | $(call MSG_L1,Creating Library $$@)
|
---|
138 | $(RM) -f $$@
|
---|
139 | $(TOOL_GCC3OMF_AR) $(flags) $$@ $(objs)
|
---|
140 |
|
---|
141 | endef
|
---|
142 |
|
---|
143 |
|
---|
144 | ## Link program
|
---|
145 | # @param $(target) Normalized main target name.
|
---|
146 | # @param $(exe) Program name.
|
---|
147 | # @param $(objs) Object files to link together.
|
---|
148 | # @param $(libs) Libraries to search.
|
---|
149 | # @param $(libpath) Library search paths.
|
---|
150 | # @param $(flags) Flags.
|
---|
151 | # @param $(dirdep) Directory creation dependency.
|
---|
152 | # @param $(deps) Other dependencies.
|
---|
153 | # @param $(othersrc) Unhandled sources.
|
---|
154 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
155 | # @param $(custom_post) Custom step invoked after linking.
|
---|
156 | #
|
---|
157 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
158 | define TOOL_GCC3OMF_LINK_PROGRAM
|
---|
159 | #$ (warning dbg: TOOL_GCC3OMF_LINK_PROGRAM: target=$(target) exe=$(exe) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
|
---|
160 | $(exe): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
|
---|
161 | $(call MSG_L1,Creating Program $$@)
|
---|
162 | ifneq ($(custom_pre),)
|
---|
163 | $(eval $(custom_pre))
|
---|
164 | endif
|
---|
165 | $(TOOL_GCC3OMF_LD) $(flags) -o $$@ $(objs) \
|
---|
166 | $(foreach p,$(libpath), -L$(p)) \
|
---|
167 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
|
---|
168 | ifneq ($(custom_post),)
|
---|
169 | $(eval $(custom_post))
|
---|
170 | endif
|
---|
171 |
|
---|
172 | endef
|
---|
173 |
|
---|
174 |
|
---|
175 | ## Link DLL
|
---|
176 | # @param $(target) Normalized main target name.
|
---|
177 | # @param $(dll) Program name.
|
---|
178 | # @param $(objs) Object files to link together.
|
---|
179 | # @param $(libs) Libraries to search.
|
---|
180 | # @param $(libpath) Library search paths.
|
---|
181 | # @param $(flags) Flags.
|
---|
182 | # @param $(dirdep) Directory creation dependency.
|
---|
183 | # @param $(deps) Other dependencies.
|
---|
184 | # @param $(othersrc) Unhandled sources.
|
---|
185 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
186 | # @param $(custom_post) Custom step invoked after linking.
|
---|
187 | #
|
---|
188 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
189 | define TOOL_GCC3OMF_LINK_DLL
|
---|
190 | #$ (warning dbg: TOOL_GCC3OMF_LINK_PROGRAM: target=$(target) dll=$(dll) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
|
---|
191 | $(dll): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
|
---|
192 | $(call MSG_L1,Creating Program $$@)
|
---|
193 | ifneq ($(custom_pre),)
|
---|
194 | $(eval $(custom_pre))
|
---|
195 | endif
|
---|
196 | $(TOOL_GCC3OMF_LD) $(TOOL_GCC3OMF_LDFLAGS.dll) $(flags) -o $$@ $(objs) \
|
---|
197 | $(foreach p,$(libpath), -L$(p)) \
|
---|
198 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
|
---|
199 | ifneq ($(custom_post),)
|
---|
200 | $(eval $(custom_post))
|
---|
201 | endif
|
---|
202 |
|
---|
203 | endef
|
---|
204 |
|
---|
205 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
206 | # @param $(target) Normalized main target name.
|
---|
207 | # @param $(sys) System module name.
|
---|
208 | # @param $(objs) Object files to link together.
|
---|
209 | # @param $(libs) Libraries to search.
|
---|
210 | # @param $(libpath) Library search paths.
|
---|
211 | # @param $(flags) Flags.
|
---|
212 | # @param $(dirdep) Directory creation dependency.
|
---|
213 | # @param $(deps) Other dependencies.
|
---|
214 | # @param $(othersrc) Unhandled sources.
|
---|
215 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
216 | # @param $(custom_post) Custom step invoked after linking.
|
---|
217 | #
|
---|
218 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
219 | define TOOL_GCC3OMF_LINK_SYSMOD
|
---|
220 | #$ (warning dbg: TOOL_GCC3OMF_LINK_SYSMOD: target=$(target) sys=$(sys) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
|
---|
221 | $(sys): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps)
|
---|
222 | $(call MSG_L1,Creating Program $$@)
|
---|
223 | ifneq ($(custom_pre),)
|
---|
224 | $(eval $(custom_pre))
|
---|
225 | endif
|
---|
226 | $(TOOL_GCC3OMF_LD_SYSMOD) $(TOOL_GCC3OMF_LDFLAGS.sysmod) $(flags) -o $$@ $(objs) \
|
---|
227 | $(foreach p,$(libpath), -L$(p)) \
|
---|
228 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))
|
---|
229 | ifneq ($(custom_post),)
|
---|
230 | $(eval $(custom_post))
|
---|
231 | endif
|
---|
232 |
|
---|
233 | endef
|
---|
234 |
|
---|