source: branches/gcc-kmk/Config.kmk@ 21808

Last change on this file since 21808 was 21804, checked in by dmik, 14 years ago

Define USE_OS2_TOOLKIT_HEADERS.

This is necessary since some APIs used by Odin are missing from the somewhat
restricted version of the OS/2 Toolkit that comes with GCC.

  • Property svn:eol-style set to native
File size: 7.7 KB
Line 
1## @file
2# Global Project Configuration File
3#
4
5#------------------------------------------------------------------------------
6# Global definitions
7#------------------------------------------------------------------------------
8
9#
10# @todo kBuild forgets to do that on OS/2
11#
12INST_DLL = bin/
13
14#
15# Watcom Linker is required because of some Watcom-specific directives (used
16# e.g. to compensate for the lack of SEGMENTS support in .DEF in emxomfld, see
17# svn.netlabs.org/libc/ticket/252). Besides, it's more stable than the outdated
18# IBM linker.
19#
20ifn1of ($(EMXOMFLD_TYPE),WLINK wlink)
21$(error You must use Watcom Linker and set EMXOMFLD_TYPE to WLINK (it's now $(EMXOMFLD_TYPE)))
22endif
23
24##
25# Defines an import library target for the given DLL target.
26#
27# @param 1 DLL target name.
28# @param 2 .def file (defaults to <1>.def).
29# @param 3 .def file for debug (defaults to <2>).
30# @param 4 non-empty to disable .def post-processing with ImpDef.
31#
32odin_implib = $(evalcall odin_implib_common,$(1),$(2),$(3),$(4))
33
34define odin_implib_common
35 local target := $(1)
36 local def := $(abspath $(PATH_SUB_CURRENT)/$(if $(2),$(2),$(1).def))
37 local def_exp := $(notdir $(basename $(def))).exp.def
38ifneq ($(3),)
39 local def_debug := $(abspath $(PATH_SUB_CURRENT)/$(3))
40 local def_exp_debug := $(notdir $(basename $(def_debug))).exp.def
41endif
42 local no_def_exp := $(4)
43 $(eval $(def_odin_implib))
44endef
45
46define def_odin_implib
47 LIBRARIES += $(target)_imp
48 $(target)_imp_TEMPLATE = OdinCxx
49 $(target)_imp_NAME = $(target)
50 $$$$($(target)_imp_0_OUTDIR)/$(def_exp): $(def) $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
51 %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
52 $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $$< $$@
53ifeq ($(def_exp_debug),)
54 ifeq ($(no_def_exp),)
55 $(target)_imp_SOURCES = $$($(target)_imp_0_OUTDIR)/$(def_exp)
56 $(target)_imp_CLEAN += $$($(target)_imp_0_OUTDIR)/$(def_exp)
57 else
58 $(target)_imp_SOURCES = $(def)
59 endif
60else
61 ifeq ($(no_def_exp),)
62 $(target)_imp_SOURCES.release = $$($(target)_imp_0_OUTDIR)/$(def_exp)
63 $(target)_imp_CLEAN.release += $$($(target)_imp_0_OUTDIR)/$(def_exp)
64 $$$$($(target)_imp_0_OUTDIR)/$(def_exp_debug): $(def_debug) | $$$$(dir $$$$@)
65 %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
66 $(QUIET2)$$(PATH_STAGE_BIN)/impdef $$< $$@
67 $(target)_imp_SOURCES.debug = $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
68 $(target)_imp_CLEAN.debug += $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
69 else
70 $(target)_imp_SOURCES.release = $(def)
71 $(target)_imp_SOURCES.debug = $(def_debug)
72 endif
73endif
74endef
75
76##
77# Shortcut to $(call odin_implib,<1>,<2>,<3>,1) used to disable .def file
78# post-processing with the ImpDef tool.
79#
80# @param 1 DLL target name.
81# @param 2 .def file (defaults to <1>.def).
82# @param 3 .def file for debug (defaults to <2>).
83#
84odin_implib_no_expdef = $(call odin_implib,$(1),$(2),(3),1)
85
86##
87# Shortcut to $(call odin_implib, <1>, <1>.def, <1>dbg.def).
88#
89# @param 1 DLL target name.
90#
91odin_implib_2 = $(call odin_implib,$(1),$(1).def,$(1)dbg.def)
92
93##
94# Shortcut to $(call odin_implib_no_expdef,<1>,<1>.def,<1>dbg.def).
95#
96# @param 1 DLL target name.
97#
98odin_implib_2_no_expdef = $(call odin_implib_no_expdef,$(1),$(1).def,$(1)dbg.def)
99
100#
101# Handler for Wine RC (.orc) source files
102#
103KBUILD_SRC_HANDLERS += .orc:def_src_handler_wrc
104define def_src_handler_wrc
105local type := WRC
106 $(kb-src-one 2)
107endef
108
109#
110# Override handler for .asm files to compile them with the MASM-compilant tool
111#
112KBUILD_SRC_HANDLERS := .asm:def_src_handler_masm $(KBUILD_SRC_HANDLERS)
113define def_src_handler_masm
114local type := $(if $(TOOL_$(tool)_COMPILE_MASM_CMDS),MASM,AS)
115 $(kb-src-one 2)
116endef
117
118#------------------------------------------------------------------------------
119# Tools
120#------------------------------------------------------------------------------
121
122#
123# Add support for Wine RC to the GCC compiler
124#
125TOOL_GXX3OMF_WRC = $(PATH_STAGE_BIN)/winerc.exe
126TOOL_GXX3OMF_WRCOBJSUFF = $(TOOL_GXX3OMF_COBJSUFF)
127TOOL_GXX3OMF_COMPILE_WRC_OUTPUT = $(outbase).orc.s
128TOOL_GXX3OMF_COMPILE_WRC_DEPEND = $(TOOL_GXX3OMF_WRC)
129TOOL_GXX3OMF_COMPILE_WRC_DEPORD =
130define TOOL_GXX3OMF_COMPILE_WRC_CMDS
131 $(QUIET)$(TOOL_GXX3OMF_WRC) -s -p _$(target) -I$(subst /,\\,$(abspath $(dir $(source))))\
132 $(flags) $(addprefix -I, $(subst /,\\,$(incs))) $(addprefix -D, $(defs))\
133 $(subst /,\\,$(abspath $(source))) \
134 -o $(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT)
135 $(QUIET)$(TOOL_GXX3OMF_CC) -E -I$(subst /,\\,$(abspath $(dir $(source))))\
136 $(flags) $(addprefix -I, $(incs)) -I . $(addprefix -D, $(defs))\
137 -x c $(abspath $(source)) \
138 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
139 $(subst $(source),$(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT),$(TOOL_GXX3OMF_COMPILE_AS_CMDS))
140endef
141
142#
143# Add support for MASM to the GCC compiler
144#
145TOOL_GXX3OMF_MASM = $(PATH_TOOL_ALP)
146TOOL_GXX3OMF_MASMFLAGS = -Mb
147TOOL_GXX3OMF_COMPILE_MASM_OUTPUT = $(outbase).lst
148TOOL_GXX3OMF_COMPILE_MASM_DEPEND =
149TOOL_GXX3OMF_COMPILE_MASM_DEPORD =
150define TOOL_GXX3OMF_COMPILE_MASM_CMDS
151 $(QUIET)$(TOOL_GXX3OMF_MASM) -D:__GNUC__ -D:__EMX__\
152 $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\
153 $(source)\
154 -Fl:$(outbase).lst\
155 -Fd:$(dep)\
156 -Fo:$(obj)
157endef
158
159#------------------------------------------------------------------------------
160# Common libraries referenced by components
161#------------------------------------------------------------------------------
162
163#------------------------------------------------------------------------------
164# General Stuff
165#------------------------------------------------------------------------------
166
167TEMPLATE_OdinCxx = Odin C/C++ sources
168TEMPLATE_OdinCxx_TOOL = GXX3OMF
169TEMPLATE_OdinCxx_INCS = $(PATH_ROOT)/include/win $(PATH_ROOT)/include $(PATH_ROOT)/include/incl_gcc
170TEMPLATE_OdinCxx_DEFS = USE_OS2_TOOLKIT_HEADERS OS2EMX_PLAIN_CHAR \
171 __WIN32OS2__ __i386__
172
173TEMPLATE_OdinDLL = Odin DLL
174TEMPLATE_OdinDLL_EXTENDS = OdinCxx
175TEMPLATE_OdinDLL_EXTENDS_BY = appending
176TEMPLATE_OdinDLL_DEFS = $(TEMPLATE_OdinCxx_DEFS) __WINE__ TCPV40HDRS COMCTL32UNDOC
177TEMPLATE_OdinDLL_LIBS = $(PATH_STAGE_LIB)/odincrt.lib \
178 $(PATH_STAGE_LIB)/initdll.lib
179
180TEMPLATE_OdinCRT = OdinCRT DLL
181TEMPLATE_OdinCRT_EXTENDS = OdinCxx
182TEMPLATE_OdinCRT_EXTENDS_BY = appending
183TEMPLATE_OdinCRT_DEFS = __WINE__
184TEMPLATE_OdinCRT_LIBS = $(PATH_STAGE_LIB)/initdll.lib
185
186TEMPLATE_OdinApp = Odin application
187TEMPLATE_OdinApp_EXTENDS = OdinCxx
188
189#------------------------------------------------------------------------------
190# GCC Stuff
191#------------------------------------------------------------------------------
192
193#------------------------------------------------------------------------------
194# Other Stuff
195#------------------------------------------------------------------------------
196
197#
198# Include a site-specific config for local overrides
199#
200ifndef LOCALCFG
201 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
202 ifneq ($(LOCALCFG),)
203 include $(LOCALCFG)
204 endif
205endif
206
207#------------------------------------------------------------------------------
208# Post-processing
209#------------------------------------------------------------------------------
210
211ifeq ($(PATH_TOOL_ALP),)
212ifneq ($(PATH_SDK_OS2TK4),)
213PATH_TOOL_ALP := $(PATH_SDK_OS2TK4)/bin/alp.exe
214else
215PATH_TOOL_ALP := alp.exe
216endif
217endif
218
219ifneq ($(PATH_SDK_OS2TK4),)
220#
221# We can't add Toolkit includes in _INCS (it will casuse then to be searched
222# before GCC headers and lead to conflicts), so use the environment variable.
223#
224C_INCLUDE_PATH := $(if $(C_INCLUDE_PATH),$(C_INCLUDE_PATH);)$(PATH_SDK_OS2TK4)/h
225CPLUS_INCLUDE_PATH := $(if $(CPLUS_INCLUDE_PATH),$(CPLUS_INCLUDE_PATH);)$(PATH_SDK_OS2TK4)/h
226endif
Note: See TracBrowser for help on using the repository browser.