#!/usr/bin/env omake #---------------------------------------------------------------------------- # Project: Horizon # File: commondefs.archiver.om # # Copyright 2007-2009 Nintendo. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # # $Date:: 2010-04-07#$ # $Rev: 13736 $ # $Author: hatamoto_minoru $ #---------------------------------------------------------------------------- declare public.UNZIP declare public.7ZIP declare public.RUBY .STATIC: 7ZIP = try 7ZIP = $(get-registry HKEY_LOCAL_MACHINE, SOFTWARE\\7-Zip, Path)$(DIRSEP)7z.exe export default .STATIC: UNZIP = if $(CheckProg_ unzip) UNZIP = $(nth 0,$(where unzip)) export .STATIC: RUBY = if $(CheckProg_ ruby) RUBY = $(nth 0,$(where ruby)) export .STATIC: RUBY_VERSION = if $(defined RUBY) RUBY_VERSION = $(string $(shell $(RUBY) --version)) export Unzip(archive, destination) = if $(defined 7ZIP) # Usage: 7z [...] [...] # [<@listfiles...>] # # # a: Add files to archive # b: Benchmark # d: Delete files from archive # e : Extract files from archive (without using directory names) # l: List contents of archive # t: Test integrity of archive # u: Update files to archive # x: eXtract files with full paths # # -ai[r[-|0]]{@listfile|!wildcard}: Include archives # -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives # -bd: Disable percentage indicator # -i[r[-|0]]{@listfile|!wildcard}: Include filenames # -m{Parameters}: set compression Method # -o{Directory}: set Output directory # -p{Password}: set Password # -r[-|0]: Recurse subdirectories # -scs{UTF-8 | WIN | DOS}: set charset for list files # -sfx[{name}]: Create SFX archive # -si[{name}]: read data from stdin # -slt: show technical information for l (List) command # -so: write data to stdout # -ssc[-]: set sensitive case mode # -ssw: compress shared files # -t{Type}: Set type of archive # -v{Size}[b|k|m|g]: Create volumes # -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options # -w[{path}]: assign Work directory. Empty path means a temporary directory # -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames # -y: assume Yes on all queries elseif $(defined UNZIP) # Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir] # Default action is to extract files in list, except those in xlist, to exdir; # file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage). # # -p extract files to pipe, no messages -l list files (short format) # -f freshen existing files, create none -t test compressed archive data # -u update files, create if necessary -z display archive comment # -x exclude files that follow (in xlist) -d extract files into exdir # # modifiers: -q quiet mode (-qq => quieter) # -n never overwrite existing files -a auto-convert any text files # -o overwrite files WITHOUT prompting -aa treat ALL files as text # -j junk paths (do not make directories) -v be verbose/print version info # -C match filenames case-insensitively -L make (some) names lowercase # -X restore UID/GID info -V retain VMS version numbers # -K keep setuid/setgid/tacky permissions -M pipe through "more" pager # Examples (see unzip.txt for more info): # unzip data1 -x joe => extract all files except joe from zipfile data1.zip # unzip -p foo | more => send contents of foo.zip via pipe into program more # unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer else eprintln($"Cannot find archiver. Install unzip or 7zip.") eprintln($"If this message appears even if it is installed, search for the tool again using omake --configure.") exit(1) ASTYLE = $(ROOT_TOOLS)/_private/AStyle.exe ASTYLE_FLAGS = --indent=spaces=4 --brackets=break --indent-preprocessor \ --max-instatement-indent=40 --min-conditional-indent=0 \ --pad-oper --unpad-paren --keep-one-line-statements --keep-one-line-blocks UNCRUSTIFY = $(file $(ROOT_TOOLS)/_private/Uncrustify.exe) UNCRUSTIFY_CONFIG = $(file $(dirname $(UNCRUSTIFY))/nintendo.cfg) IndentWithUncrustify(sources) = SUBDIR_OUTPUT = indented/ INDENTED_SOURCES = export INDENTED_SOURCES foreach(SOURCE, $(sources)) INDENTED_SOURCE = $(file $(dirname $(SOURCE))/$(SUBDIR_OUTPUT)$(basename $(SOURCE))) $(INDENTED_SOURCE): $(SOURCE) $(UNCRUSTIFY) -c $(UNCRUSTIFY_CONFIG) -f $< -o $@ INDENTED_SOURCES += $(INDENTED_SOURCE) $(INDENTED_SOURCES): $(UNCRUSTIFY_CONFIG) $(UNCRUSTIFY) return $(INDENTED_SOURCES) Indent(sources) = return $(IndentWithUncrustify $(sources))