def object(src, tgt, opts=options(), type=None, deps=None, message="OBJECT {tgt}"): if deps is None: deps = [src] if type is None: ext = os.path.basename(src).split(".")[-1] if ext in cxx_ext_list: type = "cxx" elif ext in cc_ext_list: type = "cc" elif ext in asm_ext_list: type = "asm" else: print("Unrecognized extention: {}".format(licant.util.red(ext))) exit(-1) if type == "cxx": build = licant.make.Executor(opts.cxxobjrule) elif type == "cc": build = licant.make.Executor(opts.ccobjrule) elif type == "asm": build = licant.make.Executor(opts.ccobjrule) else: print(licant.util.red("Unrecognized extention")) exit(-1) core.add( licant.make.FileTarget( opts=opts, tgt=tgt, src=src, deps=deps, build=build, message=message ) )
def static_library(tgt, srcs, opts=options(), message="STATLIB {tgt}"): core.add( licant.make.FileTarget( opts=opts, tgt=tgt, build=licant.make.Executor(opts.statlibrule), srcs=" ".join(srcs), deps=srcs, message=message, ) )
def executable(tgt, srcs, opts=options(), message="EXECUTABLE {tgt}"): core.add( licant.make.FileTarget( opts=opts, tgt=tgt, build=licant.make.Executor(opts.execrule), srcs=" ".join(srcs), deps=srcs, message=message, ) )
def dex(src, tgt, opts=java_options(), message="DEX {tgt}", deps=[]): build = licant.make.Executor(opts.dexrule) # for j in srcs: # licant.make.source(j) // scan class files core.add( licant.make.FileTarget(opts=opts, tgt=tgt, src=src, deps=deps, build=build, message=message))
def javac(srcs, tgt, opts=java_options(), message="JAVA {tgt}", deps=[]): build = licant.make.Executor(opts.javacrule) for j in srcs: licant.make.source(j) core.add( licant.make.FileTarget(opts=opts, tgt=tgt, srcs=" ".join(srcs), deps=deps + srcs, build=build, message=message))
def qt_uic(src, tgt, opts=options(), type=None, deps=None, message="UIC {tgt}"): if deps is None: deps = [src] core.add( licant.make.FileTarget( opts=opts, tgt=tgt, src=src, deps=deps, build=licant.make.Executor(opts.uicrule), message=message, ) )
def source(tgt, deps=[]): """Index source file by licant core.""" if core.exist(tgt): return target = FileTarget(build=lambda self: self.warn_if_not_exist(), deps=deps, tgt=tgt) target.clr = None target.dirkeep = licant.util.do_nothing target.update_status = UpdateStatus.Keeped core.add(target) return tgt
def copy(tgt, src, adddeps=[], message="COPY {src} {tgt}"): """Make the file copy target.""" src = os.path.expanduser(src) tgt = os.path.expanduser(tgt) source(src) core.add( FileTarget( tgt=tgt, build=Executor("cp {src} {tgt}"), src=src, deps=[src] + adddeps, message=message, )) return tgt
def objcopy(toolchain, tgt, src, format, sections, message="OBJCOPY {tgt}"): sections_str = " ".join(["-j {}".format(s) for s in sections]) rule = "{opts.toolchain.objcopy} -O {opts.format} {opts.sections_str} {opts.src} {opts.tgt}" opts = Options() opts.toolchain = toolchain opts.sections_str = sections_str opts.format = format opts.src = src opts.tgt = tgt core.add( licant.make.FileTarget( opts=opts, deps=[src], tgt=tgt, build=licant.make.Executor(rule), message=message, ) )
os.system(cmd) def objcopy(toolchain, tgt, src, format, sections, message="OBJCOPY {tgt}"): sections_str = " ".join(["-j {}".format(s) for s in sections]) rule = "{opts.toolchain.objcopy} -O {opts.format} {opts.sections_str} {opts.src} {opts.tgt}" opts = Options() opts.toolchain = toolchain opts.sections_str = sections_str opts.format = format opts.src = src opts.tgt = tgt core.add( licant.make.FileTarget( opts=opts, deps=[src], tgt=tgt, build=licant.make.Executor(rule), message=message, ) ) binutils_target = licant.core.Target( tgt="binutils", deps=[], disasm=disassembler, actions={"disasm"} ) core.add(binutils_target)
def fileset(tgt, targets, deps=[], **kwargs): """Make a fileset.""" core.add(FileSet(tgt=tgt, targets=targets, deps=deps, **kwargs)) return tgt
def makefile(tgt, deps, do, **kwargs): """Make the file copy target.""" core.add(FileTarget(tgt=tgt, build=Executor(do), deps=deps, **kwargs))