Added build all command.
This commit is contained in:
parent
250930c977
commit
e12f82b6cc
3 changed files with 16 additions and 8 deletions
|
@ -39,10 +39,9 @@ def gen(out: TextIO, context: Context):
|
||||||
|
|
||||||
writer.separator("Components")
|
writer.separator("Components")
|
||||||
|
|
||||||
for instance in context.instances:
|
all: list[str] = []
|
||||||
if not instance.enabled:
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
for instance in context.enabledInstances():
|
||||||
objects = instance.objsfiles(context)
|
objects = instance.objsfiles(context)
|
||||||
writer.comment(f"Component: {instance.manifest.id}")
|
writer.comment(f"Component: {instance.manifest.id}")
|
||||||
writer.comment(f"Resolved: {', '.join(instance.resolved)}")
|
writer.comment(f"Resolved: {', '.join(instance.resolved)}")
|
||||||
|
@ -76,8 +75,14 @@ def gen(out: TextIO, context: Context):
|
||||||
writer.build(instance.binfile(context), "ld",
|
writer.build(instance.binfile(context), "ld",
|
||||||
list(map(lambda o: o[1], objects)) + libraries)
|
list(map(lambda o: o[1], objects)) + libraries)
|
||||||
|
|
||||||
|
all.append(instance.binfile(context))
|
||||||
|
|
||||||
writer.newline()
|
writer.newline()
|
||||||
|
|
||||||
|
writer.separator("Phony targets")
|
||||||
|
|
||||||
|
writer.build("all", "phony", all)
|
||||||
|
|
||||||
|
|
||||||
def build(componentSpec: str, targetSpec: str, props: Props = {}) -> str:
|
def build(componentSpec: str, targetSpec: str, props: Props = {}) -> str:
|
||||||
context = contextFor(targetSpec, props)
|
context = contextFor(targetSpec, props)
|
||||||
|
|
|
@ -71,8 +71,8 @@ def buildCmd(args: Args):
|
||||||
componentSpec = args.consumeArg()
|
componentSpec = args.consumeArg()
|
||||||
|
|
||||||
if componentSpec is None:
|
if componentSpec is None:
|
||||||
raise Exception("Component not specified")
|
builder.buildAll(targetSpec)
|
||||||
|
else:
|
||||||
builder.build(componentSpec, targetSpec)
|
builder.build(componentSpec, targetSpec)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import cast, Protocol
|
from typing import cast, Protocol, Iterable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ class Context(IContext):
|
||||||
instances: list[ComponentInstance]
|
instances: list[ComponentInstance]
|
||||||
tools: Tools
|
tools: Tools
|
||||||
|
|
||||||
|
def enabledInstances(self) -> Iterable[ComponentInstance]:
|
||||||
|
return filter(lambda x: x.enabled, self.instances)
|
||||||
|
|
||||||
def __init__(self, target: TargetManifest, instances: list[ComponentInstance], tools: Tools):
|
def __init__(self, target: TargetManifest, instances: list[ComponentInstance], tools: Tools):
|
||||||
self.target = target
|
self.target = target
|
||||||
self.instances = instances
|
self.instances = instances
|
||||||
|
@ -84,7 +87,7 @@ class Context(IContext):
|
||||||
|
|
||||||
def cincls(self) -> list[str]:
|
def cincls(self) -> list[str]:
|
||||||
includes = list(
|
includes = list(
|
||||||
map(lambda x: x.cinclude(), self.instances))
|
map(lambda x: x.cinclude(), self.enabledInstances()))
|
||||||
return utils.uniq(includes)
|
return utils.uniq(includes)
|
||||||
|
|
||||||
def cdefs(self) -> list[str]:
|
def cdefs(self) -> list[str]:
|
||||||
|
|
Loading…
Add table
Reference in a new issue