source: branches/kmk/Config.kmk @ 312

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

branches/kmk: Fixed clean build from root.

File size: 11.4 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 $(filter %$(notdir $f),$($(target)_IDLSOURCES)) $f))
235
236$(cmds)
237
238        $(foreach f,$(out) $(output) $(output_maybe),\
239                $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
240                        $$(QUIET)$(CP) --changed $f $(filter %$(notdir $f),$($(target)_IDLSOURCES))))
241
242ifndef NO_COMPILE_CMDS_DEPS
243        %$$(QUIET2)$$(APPEND) '$(dep)'
244        %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_SOM_IDL_CMDS_PREV_'
245        %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
246        %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
247endif
248
249# if the generated file is listed in IDLSOURCES, add it to _GEN_SOURCES_ from
250# there (we did a copy trick for it), otherwise add it only of it's $(out)
251$(foreach f,$(out) $(output) $(output_maybe),\
252        $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
253                $(eval $(target)_GEN_SOURCES_ += $(filter %$(notdir $f),$($(target)_IDLSOURCES))),\
254                $(if $(findstring $f,$(out)),$(eval $(target)_GEN_SOURCES_ += $f))))
255
256# update globals and target properties.
257_OUT_FILES += $(out) $(output) $(output_maybe)
258#$(target)_GEN_SOURCES_ += $(out)
259$(target)_INTERMEDIATES += $(intermediates)
260
261endef # def_idl_rule
262
263##
264# Handler for .idl files listed in the SOURCES properties.
265#
266# .idl files are transformed into C/C++ header files and maybe to source files
267# compiled by the compiler.
268#
269# @param    target      The target file.
270# @param    source      The source file.
271# @param    lots more
272# @returns  quite a bit.
273#
274define def_src_handler_idl_idl
275
276local type      := IDL
277
278# Figure out all the props.
279local tool      := $(kb-src-tool dummy_var)
280ifeq ($(tool),)
281$(error kBuild: $(target) / $(sources) does not have IDLTOOL defined!)
282endif
283ifndef TOOL_$(tool)_IDL_CMDS
284$(error kBuild: TOOL_$(tool)_IDL_CMDS isn't defined! target=$(target) source=$(source))
285endif
286local outbase   := $(kb-obj-base outbase)
287local flags             := $(kb-src-prop IDLFLAGS,dummy_var,left-to-right,) # rest depends on flags
288local out               := $(TOOL_$(tool)_IDL_OUT)
289ifeq ($(out),)
290$(error kBuild: TOOL_$(tool)_IDL_OUT isn't defined! target=$(target) source=$(source))
291endif
292local incs              := $(kb-src-prop INCS,dummy_var,left-to-right,$(defpath))
293local defs              := $(kb-src-prop DEFS,dummy_var,left-to-right,)
294local deps              := $(kb-src-prop DEPS,dummy_var,left-to-right,$(defpath))
295local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
296
297# default path + source dep.
298ifneq ($(defpath),)
299local source    := $(abspathex $(source),$(defpath))
300endif
301local deps      += $(source)
302
303# dependency file.
304local dep               := $(out)$(SUFF_DEP)
305ifndef NO_COMPILE_CMDS_DEPS
306 _DEPFILES_INCLUDED += $(dep)
307 $(eval includedep $(dep))
308endif
309
310# Call the tool.
311local cmds                      := $(TOOL_$(tool)_IDL_CMDS)
312local output            := $(TOOL_$(tool)_IDL_OUTPUT)
313local output_maybe      := $(TOOL_$(tool)_IDL_OUTPUT_MAYBE)
314local deps                      += $(TOOL_$(tool)_IDL_DEPEND)
315local orderdeps         += $(TOOL_$(tool)_IDL_DEPORD)
316
317# Whether it generates a header file depends on flags.
318local intermediates := $(filter %.xh %.xih,$(output))
319
320# Let the target include the generated files.
321$(target)_INCS          += $(dir $(outbase))
322
323# Generate the rule.
324$(eval $(def_idl_rule))
325
326endef # def_src_handler_idl_idl
327
328#
329# Lucide SOM class DLL template
330#
331TEMPLATE_SomDll              = Lucide SOM class DLL
332TEMPLATE_SomDll_EXTENDS          = LucideCxx
333TEMPLATE_SomDll_EXTENDS_BY       = appending
334TEMPLATE_SomDll_CXXFLAGS         = -Wno-write-strings # SOM compiler is loose here
335TEMPLATE_SomDll_DEFS             = SOMLINK=_System
336TEMPLATE_SomDll_SDKS             = SOM
337TEMPLATE_SomDll_IDLTOOL          = SOM
338TEMPLATE_SomDll_IDLFLAGS         = -c -s"xc;xh;xih"
339
340#------------------------------------------------------------------------------
341# Other Stuff
342#------------------------------------------------------------------------------
343
344#
345# Include a site-specific config for local overrides
346#
347ifndef LOCALCFG
348 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
349 ifneq ($(LOCALCFG),)
350  include $(LOCALCFG)
351 endif
352endif
353
Note: See TracBrowser for help on using the repository browser.