1#----------------------------------------------------------------------------
2# Project:  Horizon
3# File:     commondefs.funcs.om
4#
5# Copyright (C)2009-2011 Nintendo Co., Ltd.  All rights reserved.
6#
7# These coded instructions, statements, and computer programs contain
8# proprietary information of Nintendo of America Inc. and/or Nintendo
9# Company Ltd., and are protected by Federal copyright law. They may
10# not be disclosed to third parties or copied or duplicated in any form,
11# in whole or in part, without the prior written consent of Nintendo.
12#
13# $Rev: 41092 $
14#----------------------------------------------------------------------------
15
16# This file is only function definitions
17# Do not add anything other than function definitions
18
19#----------------------------------------------------------------------------
20# Function definitions
21#----------------------------------------------------------------------------
22
23#------------------------------------
24#
25#------------------------------------
26
27# Find the relative path from the project root.
28# When the path is in "sources" just below the root, "sources" is also removed
29GetSubPath(path) =
30    private.apath = $(absname $(path))
31    private.subpath = $(removeprefix  $(AROOT)$(DIRSEP), $(apath))
32    private.subpath = $(removeprefix sources$(DIRSEP), $(subpath))
33
34    if $(and                                            \
35         $(or $(equal $(apath), $(subpath)),            \
36              $(and $(defined FORCE_REFERENCE_ROOT),    \
37                    $(FORCE_REFERENCE_ROOT))),          \
38         $(defined SOURCES_REFERENCE_ROOT))
39        private.subpath_refer = $(removeprefix $(absname $(SOURCES_REFERENCE_ROOT)), $(apath))
40        return $(subpath_refer)
41    else
42        if $(equal $(subpath), $(apath))
43            eprintln($"Trying to build a file outside the tree: $(apath)")
44            eprintln($"Specify a base directory manually with SOURCES_REFERENCE_ROOT.")
45            return $(basename $(apath))
46    return $(subpath)
47
48# Check the parent-child relationship of the directories
49is_under(parent_path, child_path) =
50    private.parent_path = $(absname $(parent_path))
51    private.child_path  = $(absname $(child_path))
52    if $(equal $(removeprefix $(parent_path), $(child_path)), $(child_path))
53        return false
54    else
55        return true
56
57completeLibrarySuffix(config, libfiles) =
58    private.result =
59        foreach(libfile, $(libfiles))
60            if $(findstring $(libfile), $'\.(small)|(fast)(\.|$)')
61                value $(libfile)
62            else
63                value $(libfile).$(config.effort)
64    return $(result)
65
66
67private.Bin2ObjDefaultSymbolFunction(filename) =
68    private.prefix = $(uppercase $(removesuffix $(basename $(filename))))
69    return $(prefix)_BEGIN $(prefix)_END
70
71
72
73private.CreateCmdFile(path, files) =
74    private.f = $(fopen $(path),w)
75    foreach(line, $(absname $(files)))
76        fprint($(f),$'"')
77        fprint($(f),$(line))
78        if $(and $(defined TARGET_MODULE),$(equal $(suffix $(line)),.a))
79            fprintln($(f),$'"(*)')
80        else
81            fprintln($(f),$'"')
82    close($(f))
83
84
85
86#------------------------------------
87# Root definition
88#------------------------------------
89
90#-------------------------------------------------------
91# AddRuleToMakeObjectFromC
92#
93# Overview
94#   Add a rule to create .o from .c
95#   Return the .o path
96#
97# Referenced global variables
98#   None.
99#-------------------------------------------------------
100AddRuleToMakeObjectFromC(path, src, includes, flags, flags_build, flags_scan) =
101    private.scanner_name = $(SCANNER_PREFIX)-c-$(fullname $(rootname $(path)))
102
103    .SCANNER: $(scanner_name): $(src) .PHONY/$(ROOT)/build-setup :value: $(digest-in-path-optional_ $(includes), $&)
104        $(CC) $(flags) $(flags_scan)    $(CCOUT)$(absname $(path)) $(absname $<)
105
106    $(path): $(src) :scanner: $(scanner_name) :value: $(getMtimeIfLarge $(src))
107        $(CC) $(flags) $(flags_build) -c $(CCOUT)$(absname $@) $(absname $<)
108
109    $(path): $(nth 0, $(CC)) $(makeDirectory $(dirname $(path)))
110    return $(path)
111
112
113#-------------------------------------------------------
114# AddRuleToMakeObjectFromCpp
115#
116# Description
117#   Add a rule to create .o from .cpp
118#   Return the .o path
119#
120# Referenced global variables
121#   None.
122#-------------------------------------------------------
123AddRuleToMakeObjectFromCpp(path, src, includes, flags, flags_build, flags_scan) =
124    private.scanner_name = $(SCANNER_PREFIX)-cxx-$(fullname $(rootname $(path)))
125
126    .SCANNER: $(scanner_name): $(src) .PHONY/$(ROOT)/build-setup :value: $(digest-in-path-optional_ $(includes), $&)
127        $(CXX) $(flags) $(flags_scan)     $(CCOUT)$(absname $(path)) $(absname $<)
128
129    $(path): $(src) :scanner: $(scanner_name) :value: $(getMtimeIfLarge $(src))
130        $(CXX) $(flags) $(flags_build) -c $(CCOUT)$(absname $@) $(absname $<)
131
132    $(path): $(nth 0, $(CXX)) $(makeDirectory $(dirname $(path)))
133    return $(path)
134
135
136#-------------------------------------------------------
137# AddRuleToMakeObjectFromAsm
138#
139# Description
140#   Add a rule to create .o from .s
141#   Return the .o path
142#
143# Referenced global variables
144#   None.
145#-------------------------------------------------------
146AddRuleToMakeObjectFromAsm(path, src, flags, flags_build) =
147    $(path): $(src) :effects: asmlock :value: $(getMtimeIfLarge $(src))
148        $(AS) $(flags) $(flags_build) $(ASOUT)$(absname $@) $(absname $<)
149    $(path): $(nth 0, $(AS)) $(makeDirectory $(dirname $(path)))
150    return $(path)
151
152#-------------------------------------------------------
153# AddRuleToInstall
154#
155# Description
156#   Add rule to copy a file
157#   Return the .o path
158#
159# Referenced global variables
160#   None.
161#-------------------------------------------------------
162AddRuleToInstall(dst, src) =
163    $(dst): $(makeDirectory $(dirname $(dst)))
164    $(dst): $(src)
165        cp $< $@
166    return $(dst)
167
168
169#-------------------------------------------------------
170# AddRuleToMakeStaticLibrary
171#
172# Description
173#   Add a rule to create .a from .o list
174#   Return the .a path
175#
176# Referenced global variables
177#   None.
178#-------------------------------------------------------
179AddRuleToMakeStaticLibrary(lib, srcs) =
180    $(lib): $(nth 0, $(AR))
181    $(lib): $(makeDirectory $(dirname $(lib)))
182    $(lib): $(srcs) :value: $(getMtimeIfLarge $(srcs))
183        CreateCmdFile($@.res,$^)
184        rm -f $(absname $@)
185        $(AR) $(ARFLAGS) $(absname $@) --via $(absname $@.res)
186        rm -f $@.res
187    return $(lib)
188
189
190#-------------------------------------------------------
191# AddRuleToMakeObjectFromBinary
192#
193# Description
194#   Add a rule to create .o from any file
195#   Return the .o path
196#
197# Referenced global variables
198#   None.
199#-------------------------------------------------------
200AddRuleToMakeObjectFromBinary(obj, bin, sympair, flags) =
201    private.begin = $(nth 0, $(sympair))
202    private.end   = $(nth 1, $(sympair))
203    $(obj): $(bin) $(BIN2OBJ) :value: $(getMtimeIfLarge $(bin))
204        $(BIN2OBJ) $(flags) -b $(begin) -e $(end) $< $@
205    return $(obj)
206
207
208#-------------------------------------------------------
209# AddRuleToPreProcess
210#
211# Description
212#   Add a rule to apply a C preprocess process.
213#   Return the result file path
214#
215# Referenced global variables
216#   None.
217#-------------------------------------------------------
218AddRuleToPreProcess(outfile, infile, includes, flags, flags_scan) =
219    private.scanner_name    = $(SCANNER_PREFIX)-cpp-$(fullname $(rootname $(outfile)))
220    private.outdir          = $(makeDirectory $(dirname $(outfile)))
221
222    .SCANNER: $(scanner_name): $(infile) .PHONY/$(ROOT)/build-setup :value: $(digest-in-path-optional_ $(includes), $&)
223        $(CPP) $(flags) $(flags_scan) $(CCOUT)$(absname $(outfile)) $(absname $<)
224
225    $(outfile): $(infile) $(outdir) :scanner: $(scanner_name)
226        $(CPP) $(flags) $(CCOUT)$(absname $@) $(absname $<)
227    return $(outfile)
228
229
230#-------------------------------------------------------
231# AddRuleToMakeElf
232#
233# Description
234#   Add rule to create the ELF file
235#   Return the ELF file path
236#
237# Referenced global variables
238#   None.
239#-------------------------------------------------------
240AddRuleToMakeElf(elf, flags, files, depends) =
241    private.dasm = $(file $(removesuffix $(elf))$(EXT_DASM))
242    $(elf): $(nth 0, $(LD))
243    $(elf): $(depends) :effects: $(dasm) :value: $(getMtimeIfLarge $(depends))
244        $(LD) $(LDOUT)$(absname $@) $(flags) $(set $(files))
245        $(if $(DISAS), $(DISAS) -o$(absname $(dasm)) $(absname $@))
246    return $(elf)
247
248#-------------------------------------------------------
249# AddRuleToMakeElfUsingCmdFile
250#
251# Description
252#   Add a rule to create an ELF file via the option file
253#   Return the ELF file path
254#
255# Referenced global variables
256#   None.
257#-------------------------------------------------------
258AddRuleToMakeElfUsingCmdFile(elf, flags, files, depends) =
259    private.dasm = $(file $(removesuffix $(elf))$(EXT_DASM))
260    $(elf): $(nth 0, $(LD)) $(makeDirectory $(dirname $(elf)))
261    $(elf): $(depends) :effects: $(dasm) :value: $(getMtimeIfLarge $(depends))
262        CreateCmdFile($@.res,$(set $(files)))
263        $(LD) $(LDOUT)$(absname $@) $(flags) $(LDRESP) $(absname $@.res)
264        $(if $(DISAS), $(DISAS) -o$(absname $(dasm)) $(absname $@))
265    return $(elf)
266
267
268
269makeObjectPath(src) =
270    private.oname =
271        if $(not $(is_under $(CWD), $(src)))
272            value $(rootname $(GetSubPath $(src)))$(EXT_OBJ)
273        else
274            value $(rootname $(src))$(EXT_OBJ)
275    return $(file $(makePath $(obj_dir) $(oname)))
276
277
278#   INCLUDES, CFLAGS, PREFIXED_INCLUDES, CSCANFLAGS, CCFLAGS_BUILD
279MakeObjectFromC(src) =
280    private.dst = $(makeObjectPath $(src))
281    return $(AddRuleToMakeObjectFromC $(dst),$(src),$(INCLUDES),$(CFLAGS) $(PREFIXED_INCLUDES),$(CCFLAGS_BUILD),$(CSCANFLAGS))
282
283#   INCLUDES, CXXFLAGS, PREFIXED_INCLUDS, CSCANFLAGS, CCFLAGS_BUILD
284MakeObjectFromCpp(src) =
285    private.dst = $(makeObjectPath $(src))
286    return $(AddRuleToMakeObjectFromCpp $(dst),$(src),$(INCLUDES),$(CXXFLAGS) $(PREFIXED_INCLUDES),$(CCFLAGS_BUILD),$(CSCANFLAGS))
287
288#   ASFLAGS, CCFLAGS_BUILD, PREFIXED_INCLUDES
289MakeObjectFromAsm(src) =
290    private.dst = $(makeObjectPath $(src))
291    return $(AddRuleToMakeObjectFromAsm $(dst),$(src),$(ASFLAGS) $(PREFIXED_INCLUDES),$(CCFLAGS_BUILD))
292
293
294
295#------------------------------------
296# Build control
297#------------------------------------
298
299#-------------------------------------------------------
300# ObjectOne
301#
302# Description
303#   Perform an appropriate process according to the extension of the input file
304#   Convert to the object file
305#   Return the path to the generated object file
306#
307# Referenced global variables
308#   COMPILER INCLUDES
309#-------------------------------------------------------
310ObjectOne(config, src, obj_dir) =
311    CCFLAGS        += $(COMPILER.getCCFlags $(config)) $(config.getSystemCCFlags)
312    CCFLAGS_MACRO  += $(COMPILER.getMacroFlags $(config))
313    ASFLAGS        += $(COMPILER.getASFlags $(config))
314    INCLUDES        = $(dir $(INCLUDES))
315
316    private.ofile =
317        match $(src)
318        case $"\($(EXT_C)\)$$"
319            value $(MakeObjectFromC $(src))
320        case $"\(\.cpp\)$$"
321            value $(MakeObjectFromCpp $(src))
322        case $"\($(EXT_ASM)\)$$"
323            value $(MakeObjectFromAsm $(src))
324        default
325            eprintln($"Unsupported source file: " '$(src)')
326            exit(1)
327
328    return $(ofile)
329
330#-------------------------------------------------------
331# Object
332#
333# Description
334#   Apply ObjectOne to multiple input files
335#   Return the ObjectOne result list
336#
337# Referenced global variables
338#   None.
339#-------------------------------------------------------
340Object(config, srcs) =
341    if $(not $(srcs))
342        return $(EMPTY)
343
344    private.obj_dir_parent = $(config.getObjectDirectory)
345
346    # Explicitly define rules for each file
347    private.ofiles =
348        foreach(filename, $(srcs))
349            if $(not $(equal $(filename),$(EMPTY)))
350                value $(ObjectOne $(config), $(string $(filename)), $(obj_dir_parent))
351
352    clean:
353        rm -rf $(obj_dir_parent) $(SUBDIR_OBJECTS)
354
355    return $(stripEmpty $(ofiles))
356
357
358
359#-------------------------------------------------------
360# StaticObject
361#
362# Description
363#   Apply the Object, and copy the generated file to the specified location
364#   Return the list of file paths after copying
365#
366# Referenced global variables
367#   None.
368#-------------------------------------------------------
369StaticObject(config, srcs) =
370    private.libdir = $(config.getLibraryDirectory true)
371
372    private.ofiles =
373        foreach(filename, $(srcs))
374            private.obj     = $(ObjectOne $(config),$(filename),$(config.getObjectDirectory))
375            private.libpath = $(file $(libdir)/$(config.getStaticObjectName $(rootname $(filename))))
376            value $(AddRuleToInstall $(libpath),$(obj))
377
378    clean:
379        rm -f $(ofiles)
380
381    return $(ofiles)
382
383
384#-------------------------------------------------------
385# StaticLibrary
386#
387# Description
388#   Appropriately process multiple input files according to their extensions
389#   After converting to an object file, consolidate in an .a file
390#
391#   Return the .a file path
392#
393# Referenced global variables
394#   None.
395#-------------------------------------------------------
396StaticLibrary(config, name, files, libfiles) =
397    private.libdir  = $(config.getLibraryDirectory true)
398    private.objs    = $(filter     %$(EXT_OBJ),$(files))
399    private.srcs    = $(filter-out %$(EXT_OBJ),$(files))
400    private.ofiles  = $(objs) $(Object $(config), $(srcs))
401    LIBDIR          = $(config.getLibraryDirectory false)
402    private.lfiles  =
403        foreach(lfile,$(libfiles))
404            match $(lfile)
405            case $"/|\\"
406                value $(file \
407                            $(addsuffix $(EXT_LIB), \
408                                $(completeLibrarySuffix $(config), \
409                                    $(replacesuffixes $(EXT_LIB), $"$(EMPTY)", $(lfile)))))
410            default
411                value $(file \
412                            $(addprefix $(LIBDIR)$(DIRSEP), \
413                                $(addsuffix $(EXT_LIB), \
414                                    $(completeLibrarySuffix $(config), $(lfile)))))
415    private.libpath = $(file $(libdir)$(DIRSEP)$(config.getLibraryName $(name)))
416    return $(AddRuleToMakeStaticLibrary $(libpath), $(ofiles) $(lfiles))
417
418
419#-------------------------------------------------------
420# ObjectFromBinaryWithSymbol
421#
422# Description
423#   Convert a file to an object file
424#   Return the path to the generated object file
425#
426# Referenced global variables
427#   BIN2OBJ_FLAGS
428#-------------------------------------------------------
429public.ObjectFromBinaryWithSymbol(config, files, symbol_function) =
430    private.obj_dir_parent = $(config.getObjectDirectory)
431    private.ofiles =
432        foreach(filename, $(files))
433            private.ofile = $(file $(obj_dir_parent)/$(basename $(filename))$(EXT_OBJ))
434            private.symbol_pair = $(symbol_function $(filename))
435            $(ofile): $(obj_dir_parent)
436            value $(AddRuleToMakeObjectFromBinary $(ofile),$(filename),$(symbol_pair),$(BIN2OBJ_FLAGS))
437    return $(ofiles)
438
439
440#-------------------------------------------------------
441# ObjectFromBinary
442#
443# Description
444#   Convert a file to an object file
445#   Use the default format in the generated symbol
446#   Return the path to the generated object file
447#
448# Referenced global variables
449#   None.
450#-------------------------------------------------------
451public.ObjectFromBinary(config, files) =
452    return $(ObjectFromBinaryWithSymbol $(config), $(files), $(Bin2ObjDefaultSymbolFunction))
453
454
455
456#-------------------------------------------------------
457# PreProcess
458#
459# Description
460#   Create a file that has a C preprocess process applied
461#   Return the file path after application
462#
463# Referenced global variables
464#   CCFLAGS_MACRO COMPILER
465#   INCLUDES CCFLAGS PREFIXED_INCLUDES CSCANFLAGS
466#-------------------------------------------------------
467public.PreProcess(config, infile, outfile) =
468    CCFLAGS_MACRO  += $(COMPILER.getMacroFlags $(config))
469    return $(AddRuleToPreProcess $(outfile),$(infile),$(INCLUDES),$(CCFLAGS) $(PREFIXED_INCLUDES),$(CSCANFLAGS))
470
471
472#-------------------------------------------------------
473# InstallFiles
474#
475# Description
476#   Copy multiple files
477#
478# Referenced global variables
479#   None.
480#-------------------------------------------------------
481public.InstallFiles(source_root, sources, destination) =
482    private.destination = $(absname $(destination))
483    private.source_root = $(absname $(source_root))
484    private.sources     = $(removeprefix $(source_root)$(DIRSEP), $(sources))
485
486    private.dfiles = $(addprefix $(destination)$(DIRSEP), $(sources))
487
488    .SUBDIRS: $(source_root)
489        foreach(source, $(sources))
490            private.dfile = $(addprefix $(destination)$(DIRSEP), $(source))
491            AddRuleToInstall($(dfile),$(source))
492
493    return $(dfiles)
494
495
496Elf(elf, flags, files, depends) =
497    if $(equal $(LDRESP),$(EMPTY))
498        return $(AddRuleToMakeElf $(elf), $(flags), $(files), $(depends))
499    else
500        return $(AddRuleToMakeElfUsingCmdFile $(elf), $(flags), $(files), $(depends))
501
502#-------------------------------------------------------
503# ExecutableElf
504#
505# Description
506#   Create an EXECUTABLE format ELF
507#
508# Referenced global variables
509#   LIBDIR, LDFLAGS, COMPILER, MINIMUM_LIBS, DEFAULT_LIBS,
510#   LIBS, TOOL, LIBFILES, CRT_0_O, MAPFILE, LDSCRIPT_TEMPLATE,
511#   LDSCRIPT
512#-------------------------------------------------------
513ExecutableElf(config, name, files) =
514    private.image_dir   = $(config.getImageDirectory false)
515    private.elf         = $(config.getBinaryPath $(name), $(EXT_ELF))
516    LIBDIR              = $(config.getLibraryDirectory false)
517    LDFLAGS            += $(COMPILER.getLDFlags $(config))
518
519    MINIMUM_LIBS       += $(config.getMinimumLibraries)
520    DEFAULT_LIBS       += $(config.getDefaultLibraries)
521    if $(config.isHostIoEnable)
522        DEFAULT_LIBS   += $(config.getHostIoLibraries)
523        export
524
525    private.ext_elfs    = $(addprefix %, $(EXT_OBJ) $(EXT_ELF) $(EXT_PLF))
526    private.ofiles      = $(Object $(config), $(filter-out $(ext_elfs),$(files))) $(filter $(ext_elfs),$(files))
527    private.lfiles      = $(EMPTY)
528
529    if $(not $(defined LDSCRIPT))
530        LDSCRIPT =
531        export LDSCRIPT
532
533    if $(filter %$(EXT_LIB), $(LIBS))
534        eprintln($""!!! WARNING: the LIBS variable should contain libraries _without_ extensions."")
535        LIBS = $(replacesuffixes $(EXT_LIB), $"$(EMPTY)", $(LIBS))
536        export
537
538    if $(not $(and $(defined TOOL), $(TOOL)))
539        private.filtered_lfiles = $(filter-out $"$(EMPTY)",$(LIBS))
540        export lfiles
541        export LDSCRIPT
542        lfiles          = $(file $(addprefix $(LIBDIR)$(DIRSEP), $(addsuffix $(EXT_LIB), $(completeLibrarySuffix $(config), $(filtered_lfiles)))))
543        lfiles         += $(file $(addsuffix $(EXT_LIB), $(completeLibrarySuffix $(config), $(replacesuffixes $(EXT_LIB), $"$(EMPTY)", $(LIBFILES)))))
544
545        if $(and $(defined CRT_0_O),$(not $(equal $(LDRESP),$(EMPTY))))
546            lfiles += $(file $(addprefix $(LIBDIR)$(DIRSEP), $(addsuffix $(EXT_OBJ), $(completeLibrarySuffix $(config), $(removesuffix $(CRT_0_O))))))
547
548        MAPFILE         = $(config.getMapfilePath $(name))
549        export MAPFILE
550
551        if $(defined LDSCRIPT_TEMPLATE)
552            LDSCRIPT        = $(PreProcess $(config), $(LDSCRIPT_TEMPLATE), $(absname $(config.getLdscriptPath $(name))))
553
554            $(LDSCRIPT): $(image_dir)
555
556    if $(defined LDSCRIPT)
557        $(elf): $(LDSCRIPT)
558
559    clean:
560        rm -rf $(image_dir) $(SUBDIR_IMAGES)
561
562    return $(Elf $(elf), $(LDFLAGS), $(ofiles) $(lfiles), $(ofiles) $(lfiles))
563
564#Program(config, name, files) =
565
566
567
568#------------------------------------
569# Other
570#------------------------------------
571
572# Target to execute before compiling all source files
573public.RequireSetup(targets) =
574    .PHONY/$(ROOT)/build-setup: $(targets)
575
576
577public.DefineDefaultRules() =
578
579    .DEFAULT: build
580
581    all: build tests
582
583    run: run-scripts
584
585    %.log: run-scripts
586
587    dotests run: $(RUNNER) :effects: $(RUNNER_LOCK)
588        $(RunDependMCR $@)
589
590public.ShowConfig() =
591    NOT_FOUND = $"Not found"
592    println($"Environmental Variables/Automatic Settings--------------------------------------")
593    println($"  HORIZON_ROOT:           " $(absname $(HORIZON_ROOT)))
594    println($"  HORIZON_ADDINS_ROOT:    " $(HORIZON_ADDINS_ROOT))
595    println($"  HORIZON_TARGETS:        " $(if $(defined-env HORIZON_TARGETS),                   $`(getenv HORIZON_TARGETS)))
596    println($"  ARMLMD_LICENSE_FILE:    " $(if $(defined-env ARMLMD_LICENSE_FILE),               $`(getenv ARMLMD_LICENSE_FILE)))
597    println($"  $(RVCT_ENV_PREFIX)BIN:              " $(if $(defined-env $(RVCT_ENV_PREFIX)BIN), $`(getenv $(RVCT_ENV_PREFIX)BIN)))
598    if $(defined-env $(RVCT_ENV_PREFIX)BIN)
599        ARMCC_VERSION   = $(gsub $(string $(shell $"$(RVCT_BINDIR)armcc.exe" --help)),   $" Usage:.*", $(EMPTY))
600        ARMASM_VERSION  = $(gsub $(string $(shell $"$(RVCT_BINDIR)armasm.exe" --help)),  $" Usage:.*", $(EMPTY))
601        ARMLINK_VERSION = $(gsub $(string $(shell $"$(RVCT_BINDIR)armlink.exe" --help)), $" Usage:.*", $(EMPTY))
602        ARMAR_VERSION   = $(gsub $(string $(shell $"$(RVCT_BINDIR)armar.exe" --help)),   $" - archive.*", $(EMPTY))
603        FROMELF_VERSION = $(gsub $(string $(shell $"$(RVCT_BINDIR)fromelf.exe" --help)), $"ARM image.*", $(EMPTY))
604
605        println($"                           - $(ARMCC_VERSION)")
606        println($"                           - $(ARMASM_VERSION)")
607        println($"                           - $(ARMLINK_VERSION)")
608        println($"                           - $(ARMAR_VERSION)")
609        println($"                           - $(FROMELF_VERSION)")
610    println($"  $(RVCT_ENV_PREFIX)INC:              " $(if $(defined-env $(RVCT_ENV_PREFIX)INC),           $`(getenv $(RVCT_ENV_PREFIX)INC)))
611    println($"  $(RVCT_ENV_PREFIX)LIB:              " $(if $(defined-env $(RVCT_ENV_PREFIX)LIB),           $`(getenv $(RVCT_ENV_PREFIX)LIB)))
612
613    println($" ")
614    println($"Project Settings ---------------------------------------")
615    println($"  ROOT:                   " $(absname $(ROOT)))
616    println($"  INSTALL_ROOT:           " $(absname $(INSTALL_ROOT)))
617    println($"  INSTALL_ROOT_IMAGES:    " $(absname $(INSTALL_ROOT_IMAGES)))
618    println($"  INSTALL_ROOT_LIBRARIES: " $(absname $(INSTALL_ROOT_LIBRARIES)))
619    println($" ")
620    println($"Programs ---------------------------------------------")
621
622    GCC_VERSION =
623    if $(GCC)
624        GCC_VERSION = $`(gsub $(string $(shell $(GCC) --version)), $" Copyright.*", $(EMPTY))
625        export
626
627    #OMAKE_VERSION_ = $`(gsub $(string $(shell omake --version)), $":.*", $(EMPTY))
628    println($"  GCC:                    " $(if $(equal $(GCC),   $(EMPTY)), $(NOT_FOUND), $`(GCC) [$`(GCC_VERSION)]))
629    println($"  RUBY:                   " $(if $(equal $(RUBY),  $(EMPTY)), $(NOT_FOUND), $`(RUBY) [$`(RUBY_VERSION)]))
630    println($"  7ZIP:                   " $(if $(equal $(7ZIP),  $(EMPTY)), $(NOT_FOUND), $`(7ZIP)))
631    println($"  UNZIP:                  " $(if $(equal $(UNZIP), $(EMPTY)), $(NOT_FOUND), $`(UNZIP)))
632    println($" ")
633
634
635
636public.CGeneratedFiles(files) =
637    CGeneratedFilesTarget: $(files)
638
639public.LocalCGeneratedFiles(files) =
640    .SCANNER: scan-c-%: $(files)
641    .SCANNER: scan-cxx-%: $(files)
642    .SCANNER: %$(EXT_OBJ): $(files)
643    export
644
645
646makePlatformDefsPath(name) =
647    return $(ROOT_OMAKE)/platforms/$(TARGET_PLATFORM.Name)/$(TARGET_PLATFORM.Name).$(name).om
648
649IsTestBuild() =
650    return $(filter dotests% tests, $(TARGETS))
651
652IsDocumentBuild() =
653    return $(filter documents clean-documents, $(TARGETS))
654
655
656
657
658