source: branches/kmk/Config.kmk @ 313

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

branches/kmk: Oops, don't create SOM .cpp files in root.

File size: 11.5 KB
Line 
1## @file
2# Global Project Configuration File
3#
4
5#------------------------------------------------------------------------------
6# Global definitions
7#------------------------------------------------------------------------------
8
9#
10# Lucide version string
11#
12VERSION         = 1.30 beta1
13
14#------------------------------------------------------------------------------
15# Common libraries referenced by components
16#------------------------------------------------------------------------------
17
18#
19# poppler
20#
21LIB_POPPLER_LIBS        =  $(patsubst %,$(PATH_LIB)/%$(SUFF_LIB), \
22        fofi goo poppler splash fontconfig freetype2 jpeg)
23
24#------------------------------------------------------------------------------
25# General Stuff
26#------------------------------------------------------------------------------
27
28#
29# Lucide C Compiler template
30#
31TEMPLATE_LucideC                         = Lucide C Compiler
32TEMPLATE_LucideC_TOOL            = GCC3OMF
33TEMPLATE_LucideC_CFLAGS          =
34TEMPLATE_LucideC_DEFS            = OS2
35
36#
37# Lucide C++ Compiler template
38#
39TEMPLATE_LucideCxx                       = Lucide C++ Compiler
40TEMPLATE_LucideCxx_TOOL          = GXX3OMF
41TEMPLATE_LucideCxx_CXXFLAGS      =
42TEMPLATE_LucideCxx_DEFS          = OS2
43
44#------------------------------------------------------------------------------
45# GCC Stuff
46#------------------------------------------------------------------------------
47
48#
49# Add RC support to GXX3OMF and GCC3OMF
50# (@todo create a new tool as extension to reuse the existing LINK commands)
51#
52
53TOOL_GXX3OMF_RC                                 ?= rc$(HOST_SUFF_EXE)
54TOOL_GXX3OMF_RCOBJSUFF                  ?= .res
55
56TOOL_GXX3OMF_COMPILE_RC_DEPEND   =
57TOOL_GXX3OMF_COMPILE_RC_DEPORD   =
58TOOL_GXX3OMF_COMPILE_RC_OUTPUT   =
59TOOL_GXX3OMF_COMPILE_RC_OUTPUT_MAYBE     =
60define TOOL_GXX3OMF_COMPILE_RC_CMDS
61        $(QUIET)cd $(subst /,\\,$(patsubst %/,%,$(dir $(source)))) && \
62                $(TOOL_GXX3OMF_RC) -n -r \
63                $(flags) \
64                $(addprefix -i ,$(incs)) \
65                $(addprefix -D,$(defs)) \
66                $(source) $(obj)
67endef
68
69override define TOOL_GXX3OMF_LINK_DLL_CMDS
70        $(QUIET)$(APPEND) -n $(outbase).rsp\
71                $(TOOL_GXX3OMF_LDFLAGS.dll)\
72                $(flags)\
73                -o $(out)\
74                $(filter-out %.res,$(objs))\
75                $(foreach p,$(libpath), -L$(p))\
76                $(othersrc)\
77                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
78                -Zmap=$(outbase).map
79        $(QUIET)$(TOOL_GXX3OMF_LD) @$(outbase).rsp
80        $(if $(filter %.res,$(objs)), \
81                $(QUIET)$(TOOL_GXX3OMF_RC) $(filter %.res,$(objs)) $(out))
82endef
83
84override define TOOL_GXX3OMF_LINK_PROGRAM_CMDS
85        $(QUIET)$(APPEND) -n $(outbase).rsp\
86                $(flags)\
87                -o $(out)\
88                $(filter-out %.res,$(objs))\
89                $(foreach p,$(libpath), -L$(p))\
90                $(othersrc)\
91                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
92                -Zmap=$(outbase).map
93        $(QUIET)$(TOOL_GXX3OMF_LD) @$(outbase).rsp
94        $(if $(filter %.res,$(objs)), \
95                $(QUIET)$(TOOL_GXX3OMF_RC) $(filter %.res,$(objs)) $(out))
96endef
97
98TOOL_GCC3OMF_RC                                 ?= $(TOOL_GXX3OMF_RC)
99TOOL_GCC3OMF_RCOBJSUFF                  ?= $(TOOL_GXX3OMF_RCOBJSUFF)
100
101TOOL_GCC3OMF_COMPILE_RC_DEPEND                   = $(TOOL_GXX3OMF_COMPILE_RC_DEPEND)
102TOOL_GCC3OMF_COMPILE_RC_DEPORD                   = $(TOOL_GXX3OMF_COMPILE_RC_DEPORD)
103TOOL_GCC3OMF_COMPILE_RC_OUTPUT                   = $(TOOL_GXX3OMF_COMPILE_RC_OUTPUT)
104TOOL_GCC3OMF_COMPILE_RC_OUTPUT_MAYBE     = $(TOOL_GXX3OMF_COMPILE_RC_OUTPUT_MAYBE)
105TOOL_GCC3OMF_COMPILE_RC_CMDS                     = $(TOOL_GXX3OMF_COMPILE_RC_CMDS)
106
107override define TOOL_GCC3OMF_LINK_DLL_CMDS
108        $(QUIET)$(APPEND) -n $(outbase).rsp\
109                $(TOOL_GCC3OMF_LDFLAGS.dll)\
110                $(flags)\
111                -o $(out)\
112                $(filter-out %.res,$(objs))\
113                $(foreach p,$(libpath), -L$(p))\
114                $(othersrc)\
115                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
116                -Zmap=$(outbase).map
117        $(QUIET)$(TOOL_GCC3OMF_LD) @$(outbase).rsp
118        $(if $(filter %.res,$(objs)), \
119                $(QUIET)$(TOOL_GCC3OMF_RC) $(filter %.res,$(objs)) $(out))
120endef
121
122override define TOOL_GCC3OMF_LINK_PROGRAM_CMDS
123        $(QUIET)$(APPEND) -n $(outbase).rsp\
124                $(flags)\
125                -o $(out)\
126                $(filter-out %.res,$(objs))\
127                $(foreach p,$(libpath), -L$(p))\
128                $(othersrc)\
129                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
130                -Zmap=$(outbase).map
131        $(QUIET)$(TOOL_GCC3OMF_LD) @$(outbase).rsp
132        $(if $(filter %.res,$(objs)), \
133                $(QUIET)$(TOOL_GCC3OMF_RC) $(filter %.res,$(objs)) $(out))
134endef
135
136#------------------------------------------------------------------------------
137# SOM Stuff
138#------------------------------------------------------------------------------
139
140# Paths: SOM SDK
141PATH_SDK_SOM                            ?= D:/Dev/OS2TK45/som
142ifeq ($(PATH_SDK_SOM),)
143$(error PATH_SDK_SOM is not set!)
144endif
145PATH_SDK_SOM_INCS                       ?= $(PATH_SDK_SOM)/include
146PATH_SDK_SOM_LIBPATH            ?= $(PATH_SDK_SOM)/lib
147
148# Paths: SOM Tool
149PATH_TOOL_SOM_BIN                       ?= $(PATH_SDK_SOM)/bin
150
151#
152# SOM SDK
153#
154SDK_SOM                                         := System Object Model Toolkit
155SDK_SOM_INCS                            ?= $(PATH_SDK_SOM_INCS)
156SDK_SOM_LIBPATH                         ?= $(PATH_SDK_SOM_LIBPATH)
157SDK_SOM_LIBS                            ?= somtk
158
159#
160# SOM Tool
161#
162# Notes: A valud value of the -s option must always be specified in IDLFLAGS;
163# the output of the first emitter is taken as the main output file and will be
164# sent to the compiler. All generated output go to $(dir $(outbase)) except the
165# output files ecplicitly listed in $(target)_IDLSOURCES which stay where they
166# are.
167#
168TOOL_SOM                                        := System Object Model Tooklit
169TOOL_SOM_IDL                            ?= $(PATH_TOOL_SOM_BIN)/sc$(HOST_SUFF_EXE)
170TOOL_SOM_IDLFLAGS           ?=
171TOOL_SOM_IDL_OUTPUT                      = $(addprefix $(outbase).,$(wordlist 2,1000,$(TOOL_SOM_IDL_EMITTERS)))
172TOOL_SOM_IDL_OUTPUT_MAYBE        =
173TOOL_SOM_IDL_DEPEND                      =
174TOOL_SOM_IDL_DEPORD                      =
175# IDL-specific properties
176TOOL_SOM_IDL_OUT                         = $(outbase).$(if $(filter xc,$(firstword $(TOOL_SOM_IDL_EMITTERS))),cpp,$(firstword $(TOOL_SOM_IDL_EMITTERS)))
177# SOM-specific properties
178TOOL_SOM_IDL_EMITTERS            = $(subst ;, ,$(patsubst -s"%",%,$(filter -s"%",$(flags))))
179
180## Compile an IDL file.
181#
182# @param    $(target)   Normalized main target name.
183# @param    $(source)   Source filename (relative).
184# @param    $(out)      Object file name. This shall be (re)created by the compilation.
185# @param    $(dep)      Dependcy file. This may be (re)created by the compilation.
186# @param    $(flags)    Flags.
187# @param    $(defs)     Definitions.
188# @param    $(incs)     Includes.
189# @param    $(outbase)  Output basename (full). Use this for list files and such.
190#
191define TOOL_SOM_IDL_CMDS
192        $(QUIET)$(TOOL_SOM_IDL) $(flags) \
193        $(addprefix -I, $(incs)) \
194        $(addprefix -D, $(defs)) \
195        -d $(dir $(outbase)) $(source)
196endef
197
198#
199# SOM Unit
200#
201
202# Add our target properties
203PROPS_TOOLS += IDLTOOL
204PROPS_SINGLE += IDLTOOL
205PROPS_ACCUMULATE_R += IDLFLAGS
206
207# Add ourselves to the default source handlers
208KBUILD_SRC_HANDLERS += \
209  .idl:def_src_handler_idl_idl
210
211# wrapper the compile command dependency check.
212ifndef NO_COMPILE_CMDS_DEPS
213 _UNIT_SOM_IDL_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_SOM_IDL_CMDS_PREV_),$$(commands $(out)),FORCE)
214else
215 _UNIT_SOM_IDL_CMDS_DEP =
216endif
217
218##
219# Generates the rules for running IDL comiler on a specific source file.
220#
221# @param    lots
222#
223define def_idl_rule
224
225$(out) + $(output) +| $(output_maybe) : \
226                $(deps) \
227                $(value _UNIT_SOM_IDL_CMDS_DEP) \
228                | \
229                $(orderdeps)
230        %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
231        $$(QUIET)$$(RM) -f -- $(dep) $(out) $(output) $(output_maybe)
232        $(foreach f,$(out) $(output) $(output_maybe),\
233                $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
234                        $$(QUIET)$(CP) --ignore-non-existing \
235                                $(abspathex $(filter %$(notdir $f),$($(target)_IDLSOURCES)),$($(target)_PATH)) \
236                                $f))
237
238$(cmds)
239
240        $(foreach f,$(out) $(output) $(output_maybe),\
241                $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
242                        $$(QUIET)$(CP) --changed \
243                                $f \
244                                $(abspathex $(filter %$(notdir $f),$($(target)_IDLSOURCES)),$($(target)_PATH))))
245
246ifndef NO_COMPILE_CMDS_DEPS
247        %$$(QUIET2)$$(APPEND) '$(dep)'
248        %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_SOM_IDL_CMDS_PREV_'
249        %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
250        %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
251endif
252
253# if the generated file is listed in IDLSOURCES, add it to _GEN_SOURCES_ from
254# there (we did a copy trick for it), otherwise add it only of it's $(out)
255$(foreach f,$(out) $(output) $(output_maybe),\
256        $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
257                $(eval $(target)_GEN_SOURCES_ += $(filter %$(notdir $f),$($(target)_IDLSOURCES))),\
258                $(if $(findstring $f,$(out)),$(eval $(target)_GEN_SOURCES_ += $f))))
259
260# update globals and target properties.
261_OUT_FILES += $(out) $(output) $(output_maybe)
262#$(target)_GEN_SOURCES_ += $(out)
263$(target)_INTERMEDIATES += $(intermediates)
264
265endef # def_idl_rule
266
267##
268# Handler for .idl files listed in the SOURCES properties.
269#
270# .idl files are transformed into C/C++ header files and maybe to source files
271# compiled by the compiler.
272#
273# @param    target      The target file.
274# @param    source      The source file.
275# @param    lots more
276# @returns  quite a bit.
277#
278define def_src_handler_idl_idl
279
280local type      := IDL
281
282# Figure out all the props.
283local tool      := $(kb-src-tool dummy_var)
284ifeq ($(tool),)
285$(error kBuild: $(target) / $(sources) does not have IDLTOOL defined!)
286endif
287ifndef TOOL_$(tool)_IDL_CMDS
288$(error kBuild: TOOL_$(tool)_IDL_CMDS isn't defined! target=$(target) source=$(source))
289endif
290local outbase   := $(kb-obj-base outbase)
291local flags             := $(kb-src-prop IDLFLAGS,dummy_var,left-to-right,) # rest depends on flags
292local out               := $(TOOL_$(tool)_IDL_OUT)
293ifeq ($(out),)
294$(error kBuild: TOOL_$(tool)_IDL_OUT isn't defined! target=$(target) source=$(source))
295endif
296local incs              := $(kb-src-prop INCS,dummy_var,left-to-right,$(defpath))
297local defs              := $(kb-src-prop DEFS,dummy_var,left-to-right,)
298local deps              := $(kb-src-prop DEPS,dummy_var,left-to-right,$(defpath))
299local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
300
301# default path + source dep.
302ifneq ($(defpath),)
303local source    := $(abspathex $(source),$(defpath))
304endif
305local deps      += $(source)
306
307# dependency file.
308local dep               := $(out)$(SUFF_DEP)
309ifndef NO_COMPILE_CMDS_DEPS
310 _DEPFILES_INCLUDED += $(dep)
311 $(eval includedep $(dep))
312endif
313
314# Call the tool.
315local cmds                      := $(TOOL_$(tool)_IDL_CMDS)
316local output            := $(TOOL_$(tool)_IDL_OUTPUT)
317local output_maybe      := $(TOOL_$(tool)_IDL_OUTPUT_MAYBE)
318local deps                      += $(TOOL_$(tool)_IDL_DEPEND)
319local orderdeps         += $(TOOL_$(tool)_IDL_DEPORD)
320
321# Whether it generates a header file depends on flags.
322local intermediates := $(filter %.xh %.xih,$(output))
323
324# Let the target include the generated files.
325$(target)_INCS          += $(dir $(outbase))
326
327# Generate the rule.
328$(eval $(def_idl_rule))
329
330endef # def_src_handler_idl_idl
331
332#
333# Lucide SOM class DLL template
334#
335TEMPLATE_SomDll              = Lucide SOM class DLL
336TEMPLATE_SomDll_EXTENDS          = LucideCxx
337TEMPLATE_SomDll_EXTENDS_BY       = appending
338TEMPLATE_SomDll_CXXFLAGS         = -Wno-write-strings # SOM compiler is loose here
339TEMPLATE_SomDll_DEFS             = SOMLINK=_System
340TEMPLATE_SomDll_SDKS             = SOM
341TEMPLATE_SomDll_IDLTOOL          = SOM
342TEMPLATE_SomDll_IDLFLAGS         = -c -s"xc;xh;xih"
343
344#------------------------------------------------------------------------------
345# Other Stuff
346#------------------------------------------------------------------------------
347
348#
349# Include a site-specific config for local overrides
350#
351ifndef LOCALCFG
352 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
353 ifneq ($(LOCALCFG),)
354  include $(LOCALCFG)
355 endif
356endif
357
Note: See TracBrowser for help on using the repository browser.