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

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

Add hacked WGSS50 (8ebb9961...) that suports GCC LIBC.

  • Property svn:eol-style set to native
File size: 7.1 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 = $(firstword $(PATH_TOOL_ALP) alp.exe)
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 = __WIN32OS2__ __WINE__ __i386__ TCPV40HDRS COMCTL32UNDOC
171
172TEMPLATE_OdinCRT = OdinCRT DLL
173TEMPLATE_OdinCRT_EXTENDS = OdinCxx
174TEMPLATE_OdinCRT_EXTENDS_BY = overriding
175TEMPLATE_OdinCRT_DEFS = __WIN32OS2__ __WINE__ __i386__
176TEMPLATE_OdinCRT_LIBS = $(TEMPLATE_OdinCxx_LIBS) \
177 $(PATH_STAGE_LIB)/initdll.lib
178
179TEMPLATE_OdinApp = Win32 application
180TEMPLATE_OdinApp_EXTENDS = OdinCxx
181TEMPLATE_OdinApp_EXTENDS_BY = overriding
182TEMPLATE_OdinApp_DEFS = __WIN32OS2__ __i386__
183
184TEMPLATE_OdinCxxDLL = Odin C/C++ DLL
185TEMPLATE_OdinCxxDLL_EXTENDS = OdinCxx
186TEMPLATE_OdinCxxDLL_EXTENDS_BY = overriding
187TEMPLATE_OdinCxxDLL_LIBS = $(TEMPLATE_OdinCxx_LIBS) \
188 $(PATH_STAGE_LIB)/odincrt.lib \
189 $(PATH_STAGE_LIB)/initdll.lib
190
191#------------------------------------------------------------------------------
192# GCC Stuff
193#------------------------------------------------------------------------------
194
195#------------------------------------------------------------------------------
196# Other Stuff
197#------------------------------------------------------------------------------
198
199#
200# Include a site-specific config for local overrides
201#
202ifndef LOCALCFG
203 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
204 ifneq ($(LOCALCFG),)
205 include $(LOCALCFG)
206 endif
207endif
Note: See TracBrowser for help on using the repository browser.