source: trunk/Config.kmk @ 382

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

Config.kmk: Don't use lxlite in debug mode.

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