source: trunk/Config.kmk @ 396

Last change on this file since 396 was 386, checked in by Silvan Scherrer, 11 years ago

updated aboutdlg ticket:174

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