source: trunk/Config.kmk @ 434

Last change on this file since 434 was 433, checked in by dmik, 11 years ago

Updated version to 1.32 beta.

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