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
RevLine 
[21690]1## @file
2# Global Project Configuration File
3#
4
5#------------------------------------------------------------------------------
6# Global definitions
7#------------------------------------------------------------------------------
8
[21796]9#
[21798]10# @todo kBuild forgets to do that on OS/2
11#
12INST_DLL = bin/
13
14#
[21796]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
[21756]24##
[21767]25# Defines an import library target for the given DLL target.
26#
[21756]27# @param 1 DLL target name.
[21767]28# @param 2 .def file (defaults to <1>.def).
29# @param 3 .def file for debug (defaults to <2>).
[21777]30# @param 4 non-empty to disable .def post-processing with ImpDef.
[21756]31#
[21777]32odin_implib = $(evalcall odin_implib_common,$(1),$(2),$(3),$(4))
[21767]33
34define odin_implib_common
35 local target := $(1)
[21777]36 local def := $(abspath $(PATH_SUB_CURRENT)/$(if $(2),$(2),$(1).def))
37 local def_exp := $(notdir $(basename $(def))).exp.def
[21767]38ifneq ($(3),)
[21777]39 local def_debug := $(abspath $(PATH_SUB_CURRENT)/$(3))
40 local def_exp_debug := $(notdir $(basename $(def_debug))).exp.def
[21767]41endif
[21777]42 local no_def_exp := $(4)
[21756]43 $(eval $(def_odin_implib))
44endef
45
46define def_odin_implib
[21767]47 LIBRARIES += $(target)_imp
48 $(target)_imp_TEMPLATE = OdinCxx
49 $(target)_imp_NAME = $(target)
[21795]50 $$$$($(target)_imp_0_OUTDIR)/$(def_exp): $(def) $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
[21772]51 %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
[21795]52 $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $$< $$@
[21767]53ifeq ($(def_exp_debug),)
[21777]54 ifeq ($(no_def_exp),)
[21767]55 $(target)_imp_SOURCES = $$($(target)_imp_0_OUTDIR)/$(def_exp)
56 $(target)_imp_CLEAN += $$($(target)_imp_0_OUTDIR)/$(def_exp)
[21777]57 else
[21784]58 $(target)_imp_SOURCES = $(def)
[21777]59 endif
[21756]60else
[21777]61 ifeq ($(no_def_exp),)
[21772]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)
[21777]69 else
[21784]70 $(target)_imp_SOURCES.release = $(def)
71 $(target)_imp_SOURCES.debug = $(def_debug)
[21777]72 endif
[21756]73endif
74endef
75
76##
[21777]77# Shortcut to $(call odin_implib,<1>,<2>,<3>,1) used to disable .def file
78# post-processing with the ImpDef tool.
[21767]79#
[21756]80# @param 1 DLL target name.
[21777]81# @param 2 .def file (defaults to <1>.def).
82# @param 3 .def file for debug (defaults to <2>).
[21756]83#
[21777]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).
[21767]88#
[21777]89# @param 1 DLL target name.
90#
[21767]91odin_implib_2 = $(call odin_implib,$(1),$(1).def,$(1)dbg.def)
[21756]92
[21777]93##
94# Shortcut to $(call odin_implib_no_expdef,<1>,<1>.def,<1>dbg.def).
[21767]95#
[21777]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#
[21746]101# Handler for Wine RC (.orc) source files
[21767]102#
[21746]103KBUILD_SRC_HANDLERS += .orc:def_src_handler_wrc
104define def_src_handler_wrc
105local type := WRC
106 $(kb-src-one 2)
107endef
108
[21767]109#
[21749]110# Override handler for .asm files to compile them with the MASM-compilant tool
[21767]111#
[21749]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
[21690]118#------------------------------------------------------------------------------
[21746]119# Tools
120#------------------------------------------------------------------------------
121
[21767]122#
[21746]123# Add support for Wine RC to the GCC compiler
[21767]124#
[21746]125TOOL_GXX3OMF_WRC = $(PATH_STAGE_BIN)/winerc.exe
[21749]126TOOL_GXX3OMF_WRCOBJSUFF = $(TOOL_GXX3OMF_COBJSUFF)
[21746]127TOOL_GXX3OMF_COMPILE_WRC_OUTPUT = $(outbase).orc.s
[21795]128TOOL_GXX3OMF_COMPILE_WRC_DEPEND = $(TOOL_GXX3OMF_WRC)
[21746]129TOOL_GXX3OMF_COMPILE_WRC_DEPORD =
130define TOOL_GXX3OMF_COMPILE_WRC_CMDS
[21778]131 $(QUIET)$(TOOL_GXX3OMF_WRC) -s -p _$(target) -I$(subst /,\\,$(abspath $(dir $(source))))\
[21747]132 $(flags) $(addprefix -I, $(subst /,\\,$(incs))) $(addprefix -D, $(defs))\
133 $(subst /,\\,$(abspath $(source))) \
134 -o $(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT)
[21778]135 $(QUIET)$(TOOL_GXX3OMF_CC) -E -I$(subst /,\\,$(abspath $(dir $(source))))\
[21748]136 $(flags) $(addprefix -I, $(incs)) -I . $(addprefix -D, $(defs))\
137 -x c $(abspath $(source)) \
138 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
[21747]139 $(subst $(source),$(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT),$(TOOL_GXX3OMF_COMPILE_AS_CMDS))
[21746]140endef
141
[21798]142#
143# Add support for MASM to the GCC compiler
144#
[21804]145TOOL_GXX3OMF_MASM = $(PATH_TOOL_ALP)
[21749]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
[21788]151 $(QUIET)$(TOOL_GXX3OMF_MASM) -D:__GNUC__ -D:__EMX__\
[21749]152 $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\
153 $(source)\
154 -Fl:$(outbase).lst\
155 -Fd:$(dep)\
156 -Fo:$(obj)
157endef
158
[21746]159#------------------------------------------------------------------------------
[21690]160# Common libraries referenced by components
161#------------------------------------------------------------------------------
162
163#------------------------------------------------------------------------------
164# General Stuff
165#------------------------------------------------------------------------------
166
[21733]167TEMPLATE_OdinCxx = Odin C/C++ sources
[21695]168TEMPLATE_OdinCxx_TOOL = GXX3OMF
[21736]169TEMPLATE_OdinCxx_INCS = $(PATH_ROOT)/include/win $(PATH_ROOT)/include $(PATH_ROOT)/include/incl_gcc
[21804]170TEMPLATE_OdinCxx_DEFS = USE_OS2_TOOLKIT_HEADERS OS2EMX_PLAIN_CHAR \
171 __WIN32OS2__ __i386__
[21695]172
[21803]173TEMPLATE_OdinDLL = Odin DLL
174TEMPLATE_OdinDLL_EXTENDS = OdinCxx
[21804]175TEMPLATE_OdinDLL_EXTENDS_BY = appending
[21803]176TEMPLATE_OdinDLL_DEFS = $(TEMPLATE_OdinCxx_DEFS) __WINE__ TCPV40HDRS COMCTL32UNDOC
177TEMPLATE_OdinDLL_LIBS = $(PATH_STAGE_LIB)/odincrt.lib \
178 $(PATH_STAGE_LIB)/initdll.lib
179
[21794]180TEMPLATE_OdinCRT = OdinCRT DLL
[21695]181TEMPLATE_OdinCRT_EXTENDS = OdinCxx
[21804]182TEMPLATE_OdinCRT_EXTENDS_BY = appending
[21803]183TEMPLATE_OdinCRT_DEFS = __WINE__
184TEMPLATE_OdinCRT_LIBS = $(PATH_STAGE_LIB)/initdll.lib
[21695]185
[21803]186TEMPLATE_OdinApp = Odin application
[21794]187TEMPLATE_OdinApp_EXTENDS = OdinCxx
[21695]188
[21690]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
[21804]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.