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

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

Define global DLL variables in KERNEL32 (shared segment) in a more portable way.

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