source: trunk/Config.kmk @ 374

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

Pack DLLs and EXEs with lxlite if present.

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