source: trunk/Config.kmk @ 372

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

Updated changelog and version to 1.30.

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