source: trunk/Config.kmk @ 468

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

Added setup variables for the CURL library which is required by poppler.

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