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
RevLine 
[21690]1## @file
2# Global Project Configuration File
3#
4
5#------------------------------------------------------------------------------
6# Global definitions
7#------------------------------------------------------------------------------
8
[21796]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
[21756]19##
[21767]20# Defines an import library target for the given DLL target.
21#
[21756]22# @param 1 DLL target name.
[21767]23# @param 2 .def file (defaults to <1>.def).
24# @param 3 .def file for debug (defaults to <2>).
[21777]25# @param 4 non-empty to disable .def post-processing with ImpDef.
[21756]26#
[21777]27odin_implib = $(evalcall odin_implib_common,$(1),$(2),$(3),$(4))
[21767]28
29define odin_implib_common
30 local target := $(1)
[21777]31 local def := $(abspath $(PATH_SUB_CURRENT)/$(if $(2),$(2),$(1).def))
32 local def_exp := $(notdir $(basename $(def))).exp.def
[21767]33ifneq ($(3),)
[21777]34 local def_debug := $(abspath $(PATH_SUB_CURRENT)/$(3))
35 local def_exp_debug := $(notdir $(basename $(def_debug))).exp.def
[21767]36endif
[21777]37 local no_def_exp := $(4)
[21756]38 $(eval $(def_odin_implib))
39endef
40
41define def_odin_implib
[21767]42 LIBRARIES += $(target)_imp
43 $(target)_imp_TEMPLATE = OdinCxx
44 $(target)_imp_NAME = $(target)
[21795]45 $$$$($(target)_imp_0_OUTDIR)/$(def_exp): $(def) $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
[21772]46 %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
[21795]47 $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $$< $$@
[21767]48ifeq ($(def_exp_debug),)
[21777]49 ifeq ($(no_def_exp),)
[21767]50 $(target)_imp_SOURCES = $$($(target)_imp_0_OUTDIR)/$(def_exp)
51 $(target)_imp_CLEAN += $$($(target)_imp_0_OUTDIR)/$(def_exp)
[21777]52 else
[21784]53 $(target)_imp_SOURCES = $(def)
[21777]54 endif
[21756]55else
[21777]56 ifeq ($(no_def_exp),)
[21772]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)
[21777]64 else
[21784]65 $(target)_imp_SOURCES.release = $(def)
66 $(target)_imp_SOURCES.debug = $(def_debug)
[21777]67 endif
[21756]68endif
69endef
70
71##
[21777]72# Shortcut to $(call odin_implib,<1>,<2>,<3>,1) used to disable .def file
73# post-processing with the ImpDef tool.
[21767]74#
[21756]75# @param 1 DLL target name.
[21777]76# @param 2 .def file (defaults to <1>.def).
77# @param 3 .def file for debug (defaults to <2>).
[21756]78#
[21777]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).
[21767]83#
[21777]84# @param 1 DLL target name.
85#
[21767]86odin_implib_2 = $(call odin_implib,$(1),$(1).def,$(1)dbg.def)
[21756]87
[21777]88##
89# Shortcut to $(call odin_implib_no_expdef,<1>,<1>.def,<1>dbg.def).
[21767]90#
[21777]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#
[21746]96# Handler for Wine RC (.orc) source files
[21767]97#
[21746]98KBUILD_SRC_HANDLERS += .orc:def_src_handler_wrc
99define def_src_handler_wrc
100local type := WRC
101 $(kb-src-one 2)
102endef
103
[21767]104#
[21749]105# Override handler for .asm files to compile them with the MASM-compilant tool
[21767]106#
[21749]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
[21690]113#------------------------------------------------------------------------------
[21746]114# Tools
115#------------------------------------------------------------------------------
116
[21767]117#
[21746]118# Add support for Wine RC to the GCC compiler
[21767]119#
[21746]120TOOL_GXX3OMF_WRC = $(PATH_STAGE_BIN)/winerc.exe
[21749]121TOOL_GXX3OMF_WRCOBJSUFF = $(TOOL_GXX3OMF_COBJSUFF)
[21746]122TOOL_GXX3OMF_COMPILE_WRC_OUTPUT = $(outbase).orc.s
[21795]123TOOL_GXX3OMF_COMPILE_WRC_DEPEND = $(TOOL_GXX3OMF_WRC)
[21746]124TOOL_GXX3OMF_COMPILE_WRC_DEPORD =
125define TOOL_GXX3OMF_COMPILE_WRC_CMDS
[21778]126 $(QUIET)$(TOOL_GXX3OMF_WRC) -s -p _$(target) -I$(subst /,\\,$(abspath $(dir $(source))))\
[21747]127 $(flags) $(addprefix -I, $(subst /,\\,$(incs))) $(addprefix -D, $(defs))\
128 $(subst /,\\,$(abspath $(source))) \
129 -o $(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT)
[21778]130 $(QUIET)$(TOOL_GXX3OMF_CC) -E -I$(subst /,\\,$(abspath $(dir $(source))))\
[21748]131 $(flags) $(addprefix -I, $(incs)) -I . $(addprefix -D, $(defs))\
132 -x c $(abspath $(source)) \
133 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
[21747]134 $(subst $(source),$(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT),$(TOOL_GXX3OMF_COMPILE_AS_CMDS))
[21746]135endef
136
[21749]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
[21788]143 $(QUIET)$(TOOL_GXX3OMF_MASM) -D:__GNUC__ -D:__EMX__\
[21749]144 $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\
145 $(source)\
146 -Fl:$(outbase).lst\
147 -Fd:$(dep)\
148 -Fo:$(obj)
149endef
150
[21746]151#------------------------------------------------------------------------------
[21690]152# Common libraries referenced by components
153#------------------------------------------------------------------------------
154
155#------------------------------------------------------------------------------
156# General Stuff
157#------------------------------------------------------------------------------
158
[21733]159TEMPLATE_OdinCxx = Odin C/C++ sources
[21695]160TEMPLATE_OdinCxx_TOOL = GXX3OMF
[21736]161TEMPLATE_OdinCxx_INCS = $(PATH_ROOT)/include/win $(PATH_ROOT)/include $(PATH_ROOT)/include/incl_gcc
[21695]162TEMPLATE_OdinCxx_DEFS = __WIN32OS2__ __WINE__ __i386__ TCPV40HDRS COMCTL32UNDOC
163
[21794]164TEMPLATE_OdinCRT = OdinCRT DLL
[21695]165TEMPLATE_OdinCRT_EXTENDS = OdinCxx
166TEMPLATE_OdinCRT_EXTENDS_BY = overriding
167TEMPLATE_OdinCRT_DEFS = __WIN32OS2__ __WINE__ __i386__
[21794]168TEMPLATE_OdinCRT_LIBS = $(TEMPLATE_OdinCxx_LIBS) \
169 $(PATH_STAGE_LIB)/initdll.lib
[21695]170
[21794]171TEMPLATE_OdinApp = Win32 application
172TEMPLATE_OdinApp_EXTENDS = OdinCxx
173TEMPLATE_OdinApp_EXTENDS_BY = overriding
174TEMPLATE_OdinApp_DEFS = __WIN32OS2__ __i386__
[21695]175
[21733]176TEMPLATE_OdinCxxDLL = Odin C/C++ DLL
177TEMPLATE_OdinCxxDLL_EXTENDS = OdinCxx
178TEMPLATE_OdinCxxDLL_EXTENDS_BY = overriding
[21774]179TEMPLATE_OdinCxxDLL_LIBS = $(TEMPLATE_OdinCxx_LIBS) \
[21794]180 $(PATH_STAGE_LIB)/odincrt.lib \
[21774]181 $(PATH_STAGE_LIB)/initdll.lib
[21733]182
[21690]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.