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

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

Make sure ImpDef and WineRC tools are built before they are used.

This is done by making them dependencies for .exp.def and binary
resource files respectively. These dependencies are vital in parallel builds.

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