source: trunk/Config.kmk @ 574

Last change on this file since 574 was 553, checked in by Gregg Young, 5 years ago

Fix wrc command line so it actually works on a clean build

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