source: branches/kmk/Config.kmk @ 362

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

branches/kmk: Replace the built-in install command with good old copy because the former strips EAs on OS/2 which kills file icons we attach with RC.

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