| [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 | #
 | 
|---|
 | 12 | INST_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 | #
 | 
|---|
 | 20 | ifn1of ($(EMXOMFLD_TYPE),WLINK wlink)
 | 
|---|
 | 21 | $(error You must use Watcom Linker and set EMXOMFLD_TYPE to WLINK (it's now $(EMXOMFLD_TYPE)))
 | 
|---|
 | 22 | endif
 | 
|---|
 | 23 | 
 | 
|---|
| [21864] | 24 | #
 | 
|---|
 | 25 | # TCPV40HDRS requires an alternative libsocket.lib located in a separate directory.
 | 
|---|
 | 26 | # Try to deduce it.
 | 
|---|
 | 27 | #
 | 
|---|
 | 28 | PATH_GCC_LIB_TCPIPV4 := $(dir $(shell gcc -print-file-name=libsocket.lib))/tcpipv4
 | 
|---|
 | 29 | ifeq ($(PATH_GCC_LIB_TCPIPV4),/tcpipv4)
 | 
|---|
 | 30 | $(error Could not detect the GCC TCPIPV4 socket library path.)
 | 
|---|
 | 31 | endif
 | 
|---|
 | 32 | 
 | 
|---|
| [21756] | 33 | ##
 | 
|---|
| [21767] | 34 | # Defines an import library target for the given DLL target.
 | 
|---|
 | 35 | #
 | 
|---|
| [21756] | 36 | # @param 1 DLL target name.
 | 
|---|
| [21767] | 37 | # @param 2 .def file (defaults to <1>.def).
 | 
|---|
 | 38 | # @param 3 .def file for debug (defaults to <2>).
 | 
|---|
| [21812] | 39 | # @param 4 list of object files containing additional exports.
 | 
|---|
 | 40 | # @param 5 non-empty to disable .def post-processing with ImpDef.
 | 
|---|
| [21756] | 41 | #
 | 
|---|
| [21812] | 42 | odin_implib = $(evalcall odin_implib_common,$(1),$(2),$(3),$(4),$(5))
 | 
|---|
| [21767] | 43 | 
 | 
|---|
 | 44 | define odin_implib_common
 | 
|---|
 | 45 |     local target := $(1)
 | 
|---|
| [21822] | 46 |     local def := $(abspath $(PATH_SUB_CURRENT)/$(if $(2),$(2),$(1).def))
 | 
|---|
 | 47 |     local def_exp := $(notdir $(basename $(def))).exp.def
 | 
|---|
| [21767] | 48 | ifneq ($(3),)
 | 
|---|
| [21822] | 49 |     #local def_debug := $(abspath $(PATH_SUB_CURRENT)/$(3))
 | 
|---|
 | 50 |     #local def_exp_debug := $(notdir $(basename $(def_debug))).exp.def
 | 
|---|
| [21767] | 51 | endif
 | 
|---|
| [21812] | 52 |     local obj_list := $(4)
 | 
|---|
 | 53 |     local do_def_exp := $(if $(5),,1)
 | 
|---|
| [21756] | 54 |     $(eval $(def_odin_implib))
 | 
|---|
 | 55 | endef
 | 
|---|
 | 56 | 
 | 
|---|
 | 57 | define def_odin_implib
 | 
|---|
| [21767] | 58 |     LIBRARIES += $(target)_imp
 | 
|---|
 | 59 |     $(target)_imp_TEMPLATE = OdinCxx
 | 
|---|
 | 60 |     $(target)_imp_NAME     = $(target)
 | 
|---|
| [21812] | 61 |     $$$$($(target)_imp_0_OUTDIR)/$(def_exp): $(def) \
 | 
|---|
 | 62 |       $(addsuffix $$$$(TOOL_GXX3OMF_COBJSUFF), \
 | 
|---|
 | 63 |                   $(addprefix $$$$($(target)_0_OUTDIR)/,$(obj_list))) \
 | 
|---|
 | 64 |       $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
 | 
|---|
| [21772] | 65 |                 %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
 | 
|---|
| [21812] | 66 | ifneq ($(do_def_exp),)
 | 
|---|
 | 67 |                 $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $(def) $$@
 | 
|---|
 | 68 | else
 | 
|---|
 | 69 |                 $(QUIET2)$(CP) $(def) $$@
 | 
|---|
 | 70 | endif
 | 
|---|
 | 71 | ifneq ($(obj_list),)
 | 
|---|
 | 72 |                 $(QUIET2)emxexp.exe \
 | 
|---|
 | 73 |                     $(addsuffix $$(TOOL_GXX3OMF_COBJSUFF), \
 | 
|---|
 | 74 |                                 $(addprefix $$($(target)_0_OUTDIR)/,$(obj_list))) >> $$@
 | 
|---|
 | 75 | endif
 | 
|---|
| [21767] | 76 | ifeq ($(def_exp_debug),)
 | 
|---|
| [21812] | 77 |  ifneq ($(do_def_exp)$(obj_list),)
 | 
|---|
| [21767] | 78 |     $(target)_imp_SOURCES  = $$($(target)_imp_0_OUTDIR)/$(def_exp)
 | 
|---|
 | 79 |     $(target)_imp_CLEAN   += $$($(target)_imp_0_OUTDIR)/$(def_exp)
 | 
|---|
| [21777] | 80 |  else
 | 
|---|
| [21784] | 81 |     $(target)_imp_SOURCES  = $(def)
 | 
|---|
| [21777] | 82 |  endif
 | 
|---|
| [21756] | 83 | else
 | 
|---|
| [21812] | 84 |  ifneq ($(do_def_exp)$(obj_list),)
 | 
|---|
| [21772] | 85 |     $(target)_imp_SOURCES.release  = $$($(target)_imp_0_OUTDIR)/$(def_exp)
 | 
|---|
 | 86 |     $(target)_imp_CLEAN.release   += $$($(target)_imp_0_OUTDIR)/$(def_exp)
 | 
|---|
| [21812] | 87 |     $$$$($(target)_imp_0_OUTDIR)/$(def_exp_debug): $(def_debug) \
 | 
|---|
 | 88 |         $(addsuffix $$$$(TOOL_GXX3OMF_COBJSUFF), \
 | 
|---|
 | 89 |                     $(addprefix $$$$($(target)_0_OUTDIR)/,$(obj_list))) \
 | 
|---|
 | 90 |         $$(PATH_STAGE_BIN)/impdef.exe | $$$$(dir $$$$@)
 | 
|---|
| [21772] | 91 |                 %$$(call MSG_TOOL,impdef,$(target)_imp,$(abspath $$<),$$@)
 | 
|---|
| [21812] | 92 | ifneq ($(do_def_exp),)
 | 
|---|
 | 93 |                 $(QUIET2)$$(PATH_STAGE_BIN)/impdef.exe $(def_debug) $$@
 | 
|---|
 | 94 | else
 | 
|---|
 | 95 |                 $(QUIET2)$(CP) $(def_debug) $$@
 | 
|---|
 | 96 | endif
 | 
|---|
 | 97 | ifneq ($(obj_list),)
 | 
|---|
 | 98 |                 $(QUIET2)emxexp.exe \
 | 
|---|
 | 99 |                     $(addsuffix $$(TOOL_GXX3OMF_COBJSUFF), \
 | 
|---|
 | 100 |                                 $(addprefix $$($(target)_0_OUTDIR)/,$(obj_list))) >> $$@
 | 
|---|
 | 101 | endif
 | 
|---|
| [21772] | 102 |     $(target)_imp_SOURCES.debug    = $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
 | 
|---|
 | 103 |     $(target)_imp_CLEAN.debug     += $$($(target)_imp_0_OUTDIR)/$(def_exp_debug)
 | 
|---|
| [21777] | 104 |  else
 | 
|---|
| [21784] | 105 |     $(target)_imp_SOURCES.release  = $(def)
 | 
|---|
 | 106 |     $(target)_imp_SOURCES.debug    = $(def_debug)
 | 
|---|
| [21777] | 107 |  endif
 | 
|---|
| [21756] | 108 | endif
 | 
|---|
 | 109 | endef
 | 
|---|
 | 110 | 
 | 
|---|
 | 111 | ##
 | 
|---|
| [21812] | 112 | # Shortcut to $(call odin_implib,<1>,<2>,<3>,<4>,1) used to disable .def file
 | 
|---|
| [21777] | 113 | # post-processing with the ImpDef tool.
 | 
|---|
| [21767] | 114 | #
 | 
|---|
| [21756] | 115 | # @param 1 DLL target name.
 | 
|---|
| [21777] | 116 | # @param 2 .def file (defaults to <1>.def).
 | 
|---|
 | 117 | # @param 3 .def file for debug (defaults to <2>).
 | 
|---|
| [21812] | 118 | # @param 4 list of object files containing additional exports.
 | 
|---|
| [21756] | 119 | #
 | 
|---|
| [21821] | 120 | odin_implib_no_expdef = $(call odin_implib,$(1),$(2),$(3),$(4),1)
 | 
|---|
| [21777] | 121 | 
 | 
|---|
 | 122 | ##
 | 
|---|
| [21812] | 123 | # Shortcut to $(call odin_implib, <1>,<1>.def,<1>dbg.def,<2>).
 | 
|---|
| [21767] | 124 | #
 | 
|---|
| [21777] | 125 | # @param 1 DLL target name.
 | 
|---|
| [21812] | 126 | # @param 2 list of object files containing additional exports.
 | 
|---|
| [21777] | 127 | #
 | 
|---|
| [21812] | 128 | odin_implib_2 = $(call odin_implib,$(1),$(1).def,$(1)dbg.def,$(2))
 | 
|---|
| [21756] | 129 | 
 | 
|---|
| [21777] | 130 | ##
 | 
|---|
| [21812] | 131 | # Shortcut to $(call odin_implib_no_expdef,<1>,<1>.def,<1>dbg.def,<2>).
 | 
|---|
| [21767] | 132 | #
 | 
|---|
| [21777] | 133 | # @param 1 DLL target name.
 | 
|---|
| [21812] | 134 | # @param 2 list of object files containing additional exports.
 | 
|---|
| [21777] | 135 | #
 | 
|---|
| [21812] | 136 | odin_implib_2_no_expdef = $(call odin_implib_no_expdef,$(1),$(1).def,$(1)dbg.def,$(2))
 | 
|---|
| [21777] | 137 | 
 | 
|---|
 | 138 | #
 | 
|---|
| [21746] | 139 | # Handler for Wine RC (.orc) source files
 | 
|---|
| [21767] | 140 | #
 | 
|---|
| [21746] | 141 | KBUILD_SRC_HANDLERS += .orc:def_src_handler_wrc
 | 
|---|
 | 142 | define def_src_handler_wrc
 | 
|---|
 | 143 | local type := WRC
 | 
|---|
 | 144 |  $(kb-src-one 2)
 | 
|---|
 | 145 | endef
 | 
|---|
| [21842] | 146 | PROPS_ACCUMULATE_R += WRCFLAGS
 | 
|---|
| [21746] | 147 | 
 | 
|---|
| [21767] | 148 | #
 | 
|---|
| [21749] | 149 | # Override handler for .asm files to compile them with the MASM-compilant tool
 | 
|---|
| [21767] | 150 | #
 | 
|---|
| [21749] | 151 | KBUILD_SRC_HANDLERS := .asm:def_src_handler_masm $(KBUILD_SRC_HANDLERS)
 | 
|---|
 | 152 | define def_src_handler_masm
 | 
|---|
 | 153 | local type := $(if $(TOOL_$(tool)_COMPILE_MASM_CMDS),MASM,AS)
 | 
|---|
 | 154 |  $(kb-src-one 2)
 | 
|---|
 | 155 | endef
 | 
|---|
| [21842] | 156 | PROPS_ACCUMULATE_R += $(if $(TOOL_$(tool)_COMPILE_MASM_CMDS),MASM,AS)FLAGS
 | 
|---|
| [21749] | 157 | 
 | 
|---|
| [21690] | 158 | #------------------------------------------------------------------------------
 | 
|---|
| [21746] | 159 | # Tools
 | 
|---|
 | 160 | #------------------------------------------------------------------------------
 | 
|---|
 | 161 | 
 | 
|---|
| [21767] | 162 | #
 | 
|---|
| [21746] | 163 | # Add support for Wine RC to the GCC compiler
 | 
|---|
| [21767] | 164 | #
 | 
|---|
| [21746] | 165 | TOOL_GXX3OMF_WRC                = $(PATH_STAGE_BIN)/winerc.exe
 | 
|---|
| [21861] | 166 | TOOL_GXX3OMF_WRCOBJSUFF         = .orc$(TOOL_GXX3OMF_COBJSUFF)
 | 
|---|
| [21842] | 167 | TOOL_GXX3OMF_WRCFLAGS           =
 | 
|---|
| [21746] | 168 | TOOL_GXX3OMF_COMPILE_WRC_OUTPUT = $(outbase).orc.s
 | 
|---|
| [21795] | 169 | TOOL_GXX3OMF_COMPILE_WRC_DEPEND = $(TOOL_GXX3OMF_WRC)
 | 
|---|
| [21746] | 170 | TOOL_GXX3OMF_COMPILE_WRC_DEPORD =
 | 
|---|
 | 171 | define TOOL_GXX3OMF_COMPILE_WRC_CMDS
 | 
|---|
| [21842] | 172 |         $(QUIET)$(TOOL_GXX3OMF_WRC) -s -I$(subst /,\\,$(abspath $(dir $(source))))\
 | 
|---|
| [21747] | 173 |                 $(flags) $(addprefix -I, $(subst /,\\,$(incs))) $(addprefix -D, $(defs))\
 | 
|---|
 | 174 |                 $(subst /,\\,$(abspath $(source))) \
 | 
|---|
 | 175 |                 -o $(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT)
 | 
|---|
| [21778] | 176 |         $(QUIET)$(TOOL_GXX3OMF_CC) -E -I$(subst /,\\,$(abspath $(dir $(source))))\
 | 
|---|
| [21842] | 177 |                 $(addprefix -I, $(incs)) -I . $(addprefix -D, $(defs))\
 | 
|---|
| [21748] | 178 |                 -x c $(abspath $(source)) \
 | 
|---|
 | 179 |                 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
 | 
|---|
| [21842] | 180 |         $(subst $(source),$(TOOL_GXX3OMF_COMPILE_WRC_OUTPUT),\
 | 
|---|
 | 181 |                 $(subst $(flags),,$(TOOL_GXX3OMF_COMPILE_AS_CMDS)))
 | 
|---|
| [21746] | 182 | endef
 | 
|---|
 | 183 | 
 | 
|---|
| [21798] | 184 | #
 | 
|---|
 | 185 | # Add support for MASM to the GCC compiler
 | 
|---|
 | 186 | #
 | 
|---|
| [21804] | 187 | TOOL_GXX3OMF_MASM                   = $(PATH_TOOL_ALP)
 | 
|---|
| [21749] | 188 | TOOL_GXX3OMF_MASMFLAGS              = -Mb
 | 
|---|
 | 189 | TOOL_GXX3OMF_COMPILE_MASM_OUTPUT    = $(outbase).lst
 | 
|---|
 | 190 | TOOL_GXX3OMF_COMPILE_MASM_DEPEND    =
 | 
|---|
 | 191 | TOOL_GXX3OMF_COMPILE_MASM_DEPORD    =
 | 
|---|
 | 192 | define TOOL_GXX3OMF_COMPILE_MASM_CMDS
 | 
|---|
| [21788] | 193 |         $(QUIET)$(TOOL_GXX3OMF_MASM) -D:__GNUC__ -D:__EMX__\
 | 
|---|
| [21749] | 194 |                 $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\
 | 
|---|
 | 195 |                 $(source)\
 | 
|---|
 | 196 |                 -Fl:$(outbase).lst\
 | 
|---|
 | 197 |                 -Fd:$(dep)\
 | 
|---|
 | 198 |                 -Fo:$(obj)
 | 
|---|
 | 199 | endef
 | 
|---|
 | 200 | 
 | 
|---|
| [21746] | 201 | #------------------------------------------------------------------------------
 | 
|---|
| [21690] | 202 | # Common libraries referenced by components
 | 
|---|
 | 203 | #------------------------------------------------------------------------------
 | 
|---|
 | 204 | 
 | 
|---|
 | 205 | #------------------------------------------------------------------------------
 | 
|---|
 | 206 | # General Stuff
 | 
|---|
 | 207 | #------------------------------------------------------------------------------
 | 
|---|
 | 208 | 
 | 
|---|
| [21733] | 209 | TEMPLATE_OdinCxx            = Odin C/C++ sources
 | 
|---|
| [21695] | 210 | TEMPLATE_OdinCxx_TOOL       = GXX3OMF
 | 
|---|
| [21736] | 211 | TEMPLATE_OdinCxx_INCS       = $(PATH_ROOT)/include/win $(PATH_ROOT)/include $(PATH_ROOT)/include/incl_gcc
 | 
|---|
| [21804] | 212 | TEMPLATE_OdinCxx_DEFS       = USE_OS2_TOOLKIT_HEADERS OS2EMX_PLAIN_CHAR \
 | 
|---|
 | 213 |                               __WIN32OS2__ __i386__
 | 
|---|
| [21821] | 214 | TEMPLATE_OdinCxx_DEFS.debug = DEBUG
 | 
|---|
| [21825] | 215 | TEMPLATE_OdinCxx_LDFLAGS    = -Zlinker '"DISABLE 1121"'
 | 
|---|
| [21695] | 216 | 
 | 
|---|
| [21803] | 217 | TEMPLATE_OdinDLL            = Odin DLL
 | 
|---|
 | 218 | TEMPLATE_OdinDLL_EXTENDS    = OdinCxx
 | 
|---|
| [21804] | 219 | TEMPLATE_OdinDLL_EXTENDS_BY = appending
 | 
|---|
| [21864] | 220 | TEMPLATE_OdinDLL_DEFS       = $(TEMPLATE_OdinCxx_DEFS) __WINE__ COMCTL32UNDOC TCPV40HDRS __USE_LIBC_TCPIP
 | 
|---|
| [21803] | 221 | TEMPLATE_OdinDLL_LIBS       = $(PATH_STAGE_LIB)/odincrt.lib \
 | 
|---|
 | 222 |                               $(PATH_STAGE_LIB)/initdll.lib
 | 
|---|
| [21864] | 223 | TEMPLATE_OdinDLL_LDFLAGS    = -L$(PATH_GCC_LIB_TCPIPV4) # necessary for TCPV40HDRS
 | 
|---|
| [21842] | 224 | TEMPLATE_OdinDLL_WRCFLAGS   = -p_$(target)
 | 
|---|
| [21803] | 225 | 
 | 
|---|
| [21842] | 226 | TEMPLATE_OdinSimpleDLL              = Odin DLL with ordinary entry point
 | 
|---|
 | 227 | TEMPLATE_OdinSimpleDLL_EXTENDS      = OdinDLL
 | 
|---|
 | 228 | TEMPLATE_OdinSimpleDLL_EXTENDS_BY   = overriding
 | 
|---|
 | 229 | TEMPLATE_OdinSimpleDLL_LIBS         = $(PATH_STAGE_LIB)/dllentry.o $(TEMPLATE_OdinDLL_LIBS)
 | 
|---|
 | 230 | TEMPLATE_OdinSimpleDLL_WRCFLAGS     = -p_Resource
 | 
|---|
 | 231 | 
 | 
|---|
| [21794] | 232 | TEMPLATE_OdinCRT            = OdinCRT DLL
 | 
|---|
| [21695] | 233 | TEMPLATE_OdinCRT_EXTENDS    = OdinCxx
 | 
|---|
| [21804] | 234 | TEMPLATE_OdinCRT_EXTENDS_BY = appending
 | 
|---|
| [21803] | 235 | TEMPLATE_OdinCRT_DEFS       = __WINE__
 | 
|---|
 | 236 | TEMPLATE_OdinCRT_LIBS       = $(PATH_STAGE_LIB)/initdll.lib
 | 
|---|
| [21695] | 237 | 
 | 
|---|
| [21803] | 238 | TEMPLATE_OdinApp            = Odin application
 | 
|---|
| [21794] | 239 | TEMPLATE_OdinApp_EXTENDS    = OdinCxx
 | 
|---|
| [21695] | 240 | 
 | 
|---|
| [21830] | 241 | TEMPLATE_OdinTestApp        = Odin application
 | 
|---|
 | 242 | TEMPLATE_OdinTestApp_EXTENDS= OdinApp
 | 
|---|
 | 243 | TEMPLATE_OdinTestApp_STAGE  = tests/
 | 
|---|
 | 244 | 
 | 
|---|
| [21690] | 245 | #------------------------------------------------------------------------------
 | 
|---|
 | 246 | # GCC Stuff
 | 
|---|
 | 247 | #------------------------------------------------------------------------------
 | 
|---|
 | 248 | 
 | 
|---|
 | 249 | #------------------------------------------------------------------------------
 | 
|---|
 | 250 | # Other Stuff
 | 
|---|
 | 251 | #------------------------------------------------------------------------------
 | 
|---|
 | 252 | 
 | 
|---|
 | 253 | #
 | 
|---|
 | 254 | # Include a site-specific config for local overrides
 | 
|---|
 | 255 | #
 | 
|---|
 | 256 | ifndef LOCALCFG
 | 
|---|
 | 257 |  LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
 | 
|---|
 | 258 |  ifneq ($(LOCALCFG),)
 | 
|---|
 | 259 |   include $(LOCALCFG)
 | 
|---|
 | 260 |  endif
 | 
|---|
 | 261 | endif
 | 
|---|
| [21804] | 262 | 
 | 
|---|
 | 263 | #------------------------------------------------------------------------------
 | 
|---|
 | 264 | # Post-processing
 | 
|---|
 | 265 | #------------------------------------------------------------------------------
 | 
|---|
 | 266 | 
 | 
|---|
 | 267 | ifeq ($(PATH_TOOL_ALP),)
 | 
|---|
 | 268 | ifneq ($(PATH_SDK_OS2TK4),)
 | 
|---|
 | 269 | PATH_TOOL_ALP := $(PATH_SDK_OS2TK4)/bin/alp.exe
 | 
|---|
 | 270 | else
 | 
|---|
 | 271 | PATH_TOOL_ALP := alp.exe
 | 
|---|
 | 272 | endif
 | 
|---|
 | 273 | endif
 | 
|---|
 | 274 | 
 | 
|---|
 | 275 | ifneq ($(PATH_SDK_OS2TK4),)
 | 
|---|
 | 276 | #
 | 
|---|
 | 277 | # We can't add Toolkit includes in _INCS (it will casuse then to be searched
 | 
|---|
 | 278 | # before GCC headers and lead to conflicts), so use the environment variable.
 | 
|---|
 | 279 | #
 | 
|---|
 | 280 | C_INCLUDE_PATH     := $(if $(C_INCLUDE_PATH),$(C_INCLUDE_PATH);)$(PATH_SDK_OS2TK4)/h
 | 
|---|
 | 281 | CPLUS_INCLUDE_PATH := $(if $(CPLUS_INCLUDE_PATH),$(CPLUS_INCLUDE_PATH);)$(PATH_SDK_OS2TK4)/h
 | 
|---|
 | 282 | endif
 | 
|---|