source: branches/kmk/Config.kmk @ 304

Last change on this file since 304 was 304, checked in by dmik, 12 years ago

branches/kmk: Added centralized Lucide and SOM compiler definitions.

File size: 7.7 KB
Line 
1## @file
2# Global Project Configuration File
3#
4
5#------------------------------------------------------------------------------
6# General Stuff
7#------------------------------------------------------------------------------
8
9#
10# Lucide C Compiler template
11#
12TEMPLATE_LucideC                         = Lucide C Compiler
13TEMPLATE_LucideC_TOOL            = GCC3OMF
14TEMPLATE_LucideC_CFLAGS          =
15TEMPLATE_LucideC_DEFS            = OS2
16
17#
18# Lucide C++ Compiler template
19#
20TEMPLATE_LucideCxx                       = Lucide C++ Compiler
21TEMPLATE_LucideCxx_TOOL          = GXX3OMF
22TEMPLATE_LucideCxx_CXXFLAGS      =
23TEMPLATE_LucideCxx_DEFS          = OS2
24
25#------------------------------------------------------------------------------
26# SOM Stuff
27#------------------------------------------------------------------------------
28
29# Paths: SOM SDK
30PATH_SDK_SOM                            ?= D:/Dev/OS2TK45/som
31ifeq ($(PATH_SDK_SOM),)
32$(error PATH_SDK_SOM is not set!)
33endif
34PATH_SDK_SOM_INCS                       ?= $(PATH_SDK_SOM)/include
35PATH_SDK_SOM_LIBPATH            ?= $(PATH_SDK_SOM)/lib
36
37# Paths: SOM Tool
38PATH_TOOL_SOM_BIN                       ?= $(PATH_SDK_SOM)/bin
39
40#
41# SOM SDK
42#
43SDK_SOM                                         := System Object Model Toolkit
44SDK_SOM_INCS                            ?= $(PATH_SDK_SOM_INCS)
45SDK_SOM_LIBPATH                         ?= $(PATH_SDK_SOM_LIBPATH)
46SDK_SOM_LIBS                            ?= somtk
47
48#
49# SOM Tool
50#
51# Notes: A valud value of the -s option must always be specified in IDLFLAGS;
52# the output of the first emitter is taken as the main output file and will be
53# sent to the compiler. All generated output go to $(dir $(outbase)) except the
54# output files ecplicitly listed in $(target)_IDLSOURCES which stay where they
55# are.
56#
57TOOL_SOM                                        := System Object Model Tooklit
58TOOL_SOM_IDL                            ?= $(PATH_TOOL_SOM_BIN)/sc$(HOST_SUFF_EXE)
59TOOL_SOM_IDLFLAGS           ?=
60TOOL_SOM_IDL_OUTPUT                      = $(addprefix $(outbase).,$(wordlist 2,1000,$(TOOL_SOM_IDL_EMITTERS)))
61TOOL_SOM_IDL_OUTPUT_MAYBE        =
62TOOL_SOM_IDL_DEPEND                      =
63TOOL_SOM_IDL_DEPORD                      =
64# IDL-specific properties
65TOOL_SOM_IDL_OUT                         = $(outbase).$(if $(filter xc,$(firstword $(TOOL_SOM_IDL_EMITTERS))),cpp,$(firstword $(TOOL_SOM_IDL_EMITTERS)))
66# SOM-specific properties
67TOOL_SOM_IDL_EMITTERS            = $(subst ;, ,$(patsubst -s"%",%,$(filter -s"%",$(flags))))
68
69## Compile an IDL file.
70#
71# @param    $(target)   Normalized main target name.
72# @param    $(source)   Source filename (relative).
73# @param    $(out)      Object file name. This shall be (re)created by the compilation.
74# @param    $(dep)      Dependcy file. This may be (re)created by the compilation.
75# @param    $(flags)    Flags.
76# @param    $(defs)     Definitions.
77# @param    $(incs)     Includes.
78# @param    $(outbase)  Output basename (full). Use this for list files and such.
79#
80define TOOL_SOM_IDL_CMDS
81        $(QUIET)$(TOOL_SOM_IDL) $(flags) \
82        $(addprefix -I, $(incs)) \
83        $(addprefix -D, $(defs)) \
84        -d $(dir $(outbase)) $(source)
85endef
86
87#
88# SOM Unit
89#
90
91# Add our target properties
92PROPS_TOOLS += IDLTOOL
93PROPS_SINGLE += IDLTOOL
94PROPS_ACCUMULATE_R += IDLFLAGS
95
96# Add ourselves to the default source handlers
97KBUILD_SRC_HANDLERS += \
98  .idl:def_src_handler_idl_idl
99
100# wrapper the compile command dependency check.
101ifndef NO_COMPILE_CMDS_DEPS
102 _UNIT_SOM_IDL_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_SOM_IDL_CMDS_PREV_),$$(commands $(out)),FORCE)
103else
104 _UNIT_SOM_IDL_CMDS_DEP =
105endif
106
107##
108# Generates the rules for running IDL comiler on a specific source file.
109#
110# @param    lots
111#
112define def_idl_rule
113
114$(out) + $(output) +| $(output_maybe) : \
115                $(deps) \
116                $(value _UNIT_SOM_IDL_CMDS_DEP) \
117                | \
118                $(orderdeps)
119        %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
120        $$(QUIET)$$(RM) -f -- $(dep) $(out) $(output) $(output_maybe)
121        $(foreach f,$(out) $(output) $(output_maybe),\
122                $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
123                        $$(QUIET)$(CP) --ignore-non-existing $(filter %$(notdir $f),$($(target)_IDLSOURCES)) $f))
124
125$(cmds)
126
127        $(foreach f,$(out) $(output) $(output_maybe),\
128                $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
129                        $$(QUIET)$(CP) --changed $f $(filter %$(notdir $f),$($(target)_IDLSOURCES))))
130
131ifndef NO_COMPILE_CMDS_DEPS
132        %$$(QUIET2)$$(APPEND) '$(dep)'
133        %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_SOM_IDL_CMDS_PREV_'
134        %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
135        %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
136endif
137
138# if the generated file is listed in IDLSOURCES, add it to _GEN_SOURCES_ from
139# there (we did a copy trick for it), otherwise add it only of it's $(out)
140$(foreach f,$(out) $(output) $(output_maybe),\
141        $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
142                $(eval $(target)_GEN_SOURCES_ += $(filter %$(notdir $f),$($(target)_IDLSOURCES))),\
143                $(if $(findstring $f,$(out)),$(eval $(target)_GEN_SOURCES_ += $f))))
144
145# update globals and target properties.
146_OUT_FILES += $(out) $(output) $(output_maybe)
147#$(target)_GEN_SOURCES_ += $(out)
148$(target)_INTERMEDIATES += $(intermediates)
149
150endef # def_idl_rule
151
152##
153# Handler for .idl files listed in the SOURCES properties.
154#
155# .idl files are transformed into C/C++ header files and maybe to source files
156# compiled by the compiler.
157#
158# @param    target      The target file.
159# @param    source      The source file.
160# @param    lots more
161# @returns  quite a bit.
162#
163define def_src_handler_idl_idl
164
165local type      := IDL
166
167# Figure out all the props.
168local tool      := $(kb-src-tool dummy_var)
169ifeq ($(tool),)
170$(error kBuild: $(target) / $(sources) does not have IDLTOOL defined!)
171endif
172ifndef TOOL_$(tool)_IDL_CMDS
173$(error kBuild: TOOL_$(tool)_IDL_CMDS isn't defined! target=$(target) source=$(source))
174endif
175local outbase   := $(kb-obj-base outbase)
176local flags             := $(kb-src-prop IDLFLAGS,dummy_var,left-to-right,) # rest depends on flags
177local out               := $(TOOL_$(tool)_IDL_OUT)
178ifeq ($(out),)
179$(error kBuild: TOOL_$(tool)_IDL_OUT isn't defined! target=$(target) source=$(source))
180endif
181local incs              := $(kb-src-prop INCS,dummy_var,left-to-right,$(defpath))
182local defs              := $(kb-src-prop DEFS,dummy_var,left-to-right,)
183local deps              := $(kb-src-prop DEPS,dummy_var,left-to-right,$(defpath))
184local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
185
186# default path + source dep.
187ifneq ($(defpath),)
188local source    := $(abspathex $(source),$(defpath))
189endif
190local deps      += $(source)
191
192# dependency file.
193local dep               := $(out)$(SUFF_DEP)
194ifndef NO_COMPILE_CMDS_DEPS
195 _DEPFILES_INCLUDED += $(dep)
196 $(eval includedep $(dep))
197endif
198
199# Call the tool.
200local cmds                      := $(TOOL_$(tool)_IDL_CMDS)
201local output            := $(TOOL_$(tool)_IDL_OUTPUT)
202local output_maybe      := $(TOOL_$(tool)_IDL_OUTPUT_MAYBE)
203local deps                      += $(TOOL_$(tool)_IDL_DEPEND)
204local orderdeps         += $(TOOL_$(tool)_IDL_DEPORD)
205
206# Whether it generates a header file depends on flags.
207local intermediates := $(filter %.xh %.xih,$(output))
208
209# Let the target include the generated files.
210$(target)_INCS          += $(dir $(outbase))
211
212# Generate the rule.
213$(eval $(def_idl_rule))
214
215endef # def_src_handler_idl_idl
216
217#
218# Lucide SOM class DLL template
219#
220TEMPLATE_SomDll              = Lucide SOM class DLL
221TEMPLATE_SomDll_EXTENDS          = LucideCxx
222TEMPLATE_SomDll_EXTENDS_BY       = appending
223TEMPLATE_SomDll_CXXFLAGS         = -Wno-write-strings # SOM compiler is loose here
224TEMPLATE_SomDll_DEFS             = SOMLINK=_System
225TEMPLATE_SomDll_SDKS             = SOM
226TEMPLATE_SomDll_IDLTOOL          = SOM
227TEMPLATE_SomDll_IDLFLAGS         = -c -s"xc;xh;xih"
228
229#------------------------------------------------------------------------------
230# Other Stuff
231#------------------------------------------------------------------------------
232
233#
234# Include a site-specific config for local overrides
235#
236ifndef LOCALCFG
237 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
238 ifneq ($(LOCALCFG),)
239  include $(LOCALCFG)
240 endif
241endif
242
Note: See TracBrowser for help on using the repository browser.