source: branches/kmk/Config.kmk @ 314

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

branches/kmk: Updated build instructions and env.cmd to work with standalone SOM SDK.

File size: 11.9 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$(HOSTSUFF_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 (defaults to the one from the OS/2 Toolkit installation)
141PATH_SDK_SOM                            ?= $(subst \,/,$(SOMBASE))
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
150PATH_TOOL_SOM_DLL                       ?= $(PATH_SDK_SOM)/lib
151PATH_TOOL_SOM_MSG                       ?= $(PATH_SDK_SOM)/msg
152PATH_TOOL_SOM_INC                       ?= $(PATH_SDK_SOM)/include
153
154#
155# SOM SDK
156#
157SDK_SOM                                         := System Object Model Toolkit
158SDK_SOM_INCS                            ?= $(PATH_SDK_SOM_INCS)
159SDK_SOM_LIBPATH                         ?= $(PATH_SDK_SOM_LIBPATH)
160SDK_SOM_LIBS                            ?= somtk
161
162#
163# SOM Tool
164#
165# Notes: A valud value of the -s option must always be specified in IDLFLAGS;
166# the output of the first emitter is taken as the main output file and will be
167# sent to the compiler. All generated output go to $(dir $(outbase)) except the
168# output files ecplicitly listed in $(target)_IDLSOURCES which stay where they
169# are.
170#
171TOOL_SOM                                        := System Object Model Tooklit
172TOOL_SOM_IDL                            ?= $(PATH_TOOL_SOM_BIN)/sc$(HOSTSUFF_EXE)
173TOOL_SOM_IDLFLAGS           ?=
174TOOL_SOM_IDL_OUTPUT                      = $(addprefix $(outbase).,$(wordlist 2,1000,$(TOOL_SOM_IDL_EMITTERS)))
175TOOL_SOM_IDL_OUTPUT_MAYBE        =
176TOOL_SOM_IDL_DEPEND                      =
177TOOL_SOM_IDL_DEPORD                      =
178# IDL-specific properties
179TOOL_SOM_IDL_OUT                         = $(outbase).$(if $(filter xc,$(firstword $(TOOL_SOM_IDL_EMITTERS))),cpp,$(firstword $(TOOL_SOM_IDL_EMITTERS)))
180# SOM-specific properties
181TOOL_SOM_IDL_EMITTERS            = $(subst ;, ,$(patsubst -s"%",%,$(filter -s"%",$(flags))))
182
183## Compile an IDL file.
184#
185# @param    $(target)   Normalized main target name.
186# @param    $(source)   Source filename (relative).
187# @param    $(out)      Object file name. This shall be (re)created by the compilation.
188# @param    $(dep)      Dependcy file. This may be (re)created by the compilation.
189# @param    $(flags)    Flags.
190# @param    $(defs)     Definitions.
191# @param    $(incs)     Includes.
192# @param    $(outbase)  Output basename (full). Use this for list files and such.
193#
194define TOOL_SOM_IDL_CMDS
195        $(QUIET)$(REDIRECT) \
196        -E 'PATH=$(PATH_TOOL_SOM_BIN);$(PATH)' \
197        -E 'BEGINLIBPATH=$(PATH_TOOL_SOM_DLL);$(BEGINLIBPATH)' \
198        -E 'DPATH=$(PATH_TOOL_SOM_MSG);$(DPATH)' \
199        -E 'SMINCLUDE=$(PATH_TOOL_SOM_INC);$(INCLUDE)' \
200        -E 'INCLUDE=' \
201        -E 'LIB=' \
202        -- \
203        $(TOOL_SOM_IDL) $(flags) \
204        $(addprefix -I, $(incs)) \
205        $(addprefix -D, $(defs)) \
206        -d $(dir $(outbase)) $(source)
207endef
208
209#
210# SOM Unit
211#
212
213# Add our target properties
214PROPS_TOOLS += IDLTOOL
215PROPS_SINGLE += IDLTOOL
216PROPS_ACCUMULATE_R += IDLFLAGS
217
218# Add ourselves to the default source handlers
219KBUILD_SRC_HANDLERS += \
220  .idl:def_src_handler_idl_idl
221
222# wrapper the compile command dependency check.
223ifndef NO_COMPILE_CMDS_DEPS
224 _UNIT_SOM_IDL_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_SOM_IDL_CMDS_PREV_),$$(commands $(out)),FORCE)
225else
226 _UNIT_SOM_IDL_CMDS_DEP =
227endif
228
229##
230# Generates the rules for running IDL comiler on a specific source file.
231#
232# @param    lots
233#
234define def_idl_rule
235
236$(out) + $(output) +| $(output_maybe) : \
237                $(deps) \
238                $(value _UNIT_SOM_IDL_CMDS_DEP) \
239                | \
240                $(orderdeps)
241        %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
242        $$(QUIET)$$(RM) -f -- $(dep) $(out) $(output) $(output_maybe)
243        $(foreach f,$(out) $(output) $(output_maybe),\
244                $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
245                        $$(QUIET)$(CP) --ignore-non-existing \
246                                $(abspathex $(filter %$(notdir $f),$($(target)_IDLSOURCES)),$($(target)_PATH)) \
247                                $f))
248
249$(cmds)
250
251        $(foreach f,$(out) $(output) $(output_maybe),\
252                $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
253                        $$(QUIET)$(CP) --changed \
254                                $f \
255                                $(abspathex $(filter %$(notdir $f),$($(target)_IDLSOURCES)),$($(target)_PATH))))
256
257ifndef NO_COMPILE_CMDS_DEPS
258        %$$(QUIET2)$$(APPEND) '$(dep)'
259        %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_SOM_IDL_CMDS_PREV_'
260        %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
261        %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
262endif
263
264# if the generated file is listed in IDLSOURCES, add it to _GEN_SOURCES_ from
265# there (we did a copy trick for it), otherwise add it only of it's $(out)
266$(foreach f,$(out) $(output) $(output_maybe),\
267        $(if $(findstring $(notdir $f),$(notdir $($(target)_IDLSOURCES))),\
268                $(eval $(target)_GEN_SOURCES_ += $(filter %$(notdir $f),$($(target)_IDLSOURCES))),\
269                $(if $(findstring $f,$(out)),$(eval $(target)_GEN_SOURCES_ += $f))))
270
271# update globals and target properties.
272_OUT_FILES += $(out) $(output) $(output_maybe)
273#$(target)_GEN_SOURCES_ += $(out)
274$(target)_INTERMEDIATES += $(intermediates)
275
276endef # def_idl_rule
277
278##
279# Handler for .idl files listed in the SOURCES properties.
280#
281# .idl files are transformed into C/C++ header files and maybe to source files
282# compiled by the compiler.
283#
284# @param    target      The target file.
285# @param    source      The source file.
286# @param    lots more
287# @returns  quite a bit.
288#
289define def_src_handler_idl_idl
290
291local type      := IDL
292
293# Figure out all the props.
294local tool      := $(kb-src-tool dummy_var)
295ifeq ($(tool),)
296$(error kBuild: $(target) / $(sources) does not have IDLTOOL defined!)
297endif
298ifndef TOOL_$(tool)_IDL_CMDS
299$(error kBuild: TOOL_$(tool)_IDL_CMDS isn't defined! target=$(target) source=$(source))
300endif
301local outbase   := $(kb-obj-base outbase)
302local flags             := $(kb-src-prop IDLFLAGS,dummy_var,left-to-right,) # rest depends on flags
303local out               := $(TOOL_$(tool)_IDL_OUT)
304ifeq ($(out),)
305$(error kBuild: TOOL_$(tool)_IDL_OUT isn't defined! target=$(target) source=$(source))
306endif
307local incs              := $(kb-src-prop INCS,dummy_var,left-to-right,$(defpath))
308local defs              := $(kb-src-prop DEFS,dummy_var,left-to-right,)
309local deps              := $(kb-src-prop DEPS,dummy_var,left-to-right,$(defpath))
310local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
311
312# default path + source dep.
313ifneq ($(defpath),)
314local source    := $(abspathex $(source),$(defpath))
315endif
316local deps      += $(source)
317
318# dependency file.
319local dep               := $(out)$(SUFF_DEP)
320ifndef NO_COMPILE_CMDS_DEPS
321 _DEPFILES_INCLUDED += $(dep)
322 $(eval includedep $(dep))
323endif
324
325# Call the tool.
326local cmds                      := $(TOOL_$(tool)_IDL_CMDS)
327local output            := $(TOOL_$(tool)_IDL_OUTPUT)
328local output_maybe      := $(TOOL_$(tool)_IDL_OUTPUT_MAYBE)
329local deps                      += $(TOOL_$(tool)_IDL_DEPEND)
330local orderdeps         += $(TOOL_$(tool)_IDL_DEPORD)
331
332# Whether it generates a header file depends on flags.
333local intermediates := $(filter %.xh %.xih,$(output))
334
335# Let the target include the generated files.
336$(target)_INCS          += $(dir $(outbase))
337
338# Generate the rule.
339$(eval $(def_idl_rule))
340
341endef # def_src_handler_idl_idl
342
343#
344# Lucide SOM class DLL template
345#
346TEMPLATE_SomDll              = Lucide SOM class DLL
347TEMPLATE_SomDll_EXTENDS          = LucideCxx
348TEMPLATE_SomDll_EXTENDS_BY       = appending
349TEMPLATE_SomDll_CXXFLAGS         = -Wno-write-strings # SOM compiler is loose here
350TEMPLATE_SomDll_DEFS             = SOMLINK=_System
351TEMPLATE_SomDll_SDKS             = SOM
352TEMPLATE_SomDll_IDLTOOL          = SOM
353TEMPLATE_SomDll_IDLFLAGS         = -c -s"xc;xh;xih"
354
355#------------------------------------------------------------------------------
356# Other Stuff
357#------------------------------------------------------------------------------
358
359#
360# Include a site-specific config for local overrides
361#
362ifndef LOCALCFG
363 LOCALCFG := $(wildcard $(PATH_ROOT)/LocalConfig.kmk)
364 ifneq ($(LOCALCFG),)
365  include $(LOCALCFG)
366 endif
367endif
368
Note: See TracBrowser for help on using the repository browser.