mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Refactoring build system for more control of inputs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
ninja_required_version = 1.3
|
||||
builddir = {{ buildroot }}
|
||||
srcroot = {{ srcroot }}
|
||||
modulefile = {{ modulefile }}
|
||||
|
||||
warnflags = $
|
||||
-Wformat=2 $
|
||||
@@ -75,7 +76,7 @@ rule lib
|
||||
rule regen
|
||||
generator = true
|
||||
description = Regenrating build files
|
||||
command = {{ generator }} $builddir
|
||||
command = {{ generator }} $builddir $modulefile
|
||||
|
||||
rule cp
|
||||
description = Copying $name
|
||||
@@ -117,6 +118,7 @@ build $
|
||||
{%- for template in templates %}
|
||||
{{ template }} $
|
||||
{%- endfor %}
|
||||
$modulefile $
|
||||
{{ generator }}
|
||||
|
||||
build $builddir/flash.img : cp $srcroot/assets/ovmf/x64/OVMF.fd
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "program.default.ninja.j2" %}
|
||||
{% extends "exe.default.j2" %}
|
||||
{% block variables %}
|
||||
{{ super() }}
|
||||
|
||||
12
scripts/templates/exe.default.j2
Normal file
12
scripts/templates/exe.default.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "module.base.j2" %}
|
||||
{% block variables %}
|
||||
{{ super() }}
|
||||
|
||||
libs = $
|
||||
-L${builddir} $
|
||||
{%- for dep in module.libdeps %}
|
||||
-l{{ dep.name }} $
|
||||
{%- endfor %}
|
||||
$libs
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "program.default.ninja.j2" %}
|
||||
{% extends "exe.default.j2" %}
|
||||
{% block variables %}
|
||||
{{ super() }}
|
||||
|
||||
1
scripts/templates/lib.default.j2
Normal file
1
scripts/templates/lib.default.j2
Normal file
@@ -0,0 +1 @@
|
||||
{% extends "module.base.j2" %}
|
||||
@@ -1 +0,0 @@
|
||||
{% extends "module.base.ninja.j2" %}
|
||||
38
scripts/templates/module.base.j2
Normal file
38
scripts/templates/module.base.j2
Normal file
@@ -0,0 +1,38 @@
|
||||
moddir = ${builddir}/{{ module.name }}.dir
|
||||
|
||||
{% block variables %}
|
||||
ccflags = $ccflags $
|
||||
{%- for dep in module.depmods %}
|
||||
{%- for inc in dep.includes %}
|
||||
-I${srcroot}/{{ inc }} $
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
{%- for inc in module.includes %}
|
||||
-I${srcroot}/{{ inc }} $
|
||||
{%- endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% for source in module.sources %}
|
||||
build ${moddir}/{{ source.output }} : {{ source.action }} {{ source.input }} || {{ buildfile }}
|
||||
name = {{ source.name }}
|
||||
{% endfor %}
|
||||
|
||||
build ${builddir}/{{ module.output }} : {{ module.kind }} $
|
||||
{%- for source in module.sources %}
|
||||
${moddir}/{{ source.output }} $
|
||||
{%- endfor -%}
|
||||
{%- for dep in module.libdeps %}
|
||||
${builddir}/{{ dep.output }} $
|
||||
{%- endfor %}
|
||||
| $
|
||||
{% for dep in module.exedeps %}
|
||||
${builddir}/{{ dep.output }} $
|
||||
{%- endfor -%}
|
||||
{{ buildfile }}
|
||||
name = {{ module.name }}
|
||||
|
||||
{% block extra %}
|
||||
{% endblock %}
|
||||
|
||||
# vim: ft=ninja et ts=4 sts=4 sw=4
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
moddir = ${builddir}/{{ name }}.dir
|
||||
|
||||
{% block variables %}
|
||||
ccflags = $ccflags $
|
||||
{%- for dep in module.deps %}
|
||||
-I${srcroot}/src/libraries/{{ dep }}/include $
|
||||
{%- endfor %}
|
||||
-I${srcroot}/{{ module.path }} $
|
||||
-I${srcroot}/{{ module.path }}/include
|
||||
{% endblock %}
|
||||
|
||||
{% for source in sources %}
|
||||
build ${moddir}/{{ source.output }} : {{ source.action }} {{ source.input }} || {{ buildfile }}
|
||||
name = {{ source.name }}
|
||||
{% endfor %}
|
||||
|
||||
build {% block artifact %} ${builddir}/lib{{ name }}.a : lib {% endblock %} $
|
||||
{%- block extrasources %}{% endblock -%}
|
||||
{%- for source in sources %}
|
||||
${moddir}/{{ source.output }}{% if not loop.last %} ${% endif %}
|
||||
{%- endfor -%}
|
||||
{%- if module.deps %}| {% for dep in module.deps %} ${builddir}/lib{{ dep }}.a {% endfor %}{% endif %}
|
||||
name = {{ name }}
|
||||
|
||||
{% block extra %}
|
||||
{% endblock %}
|
||||
|
||||
# vim: ft=ninja et ts=4 sts=4 sw=4
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{% extends "module.base.ninja.j2" %}
|
||||
{% block variables %}
|
||||
{{ super() }}
|
||||
|
||||
libs = $
|
||||
-L${builddir} $
|
||||
{%- for dep in module.deps %}
|
||||
-l{{dep}} $
|
||||
{%- endfor %}
|
||||
$libs
|
||||
|
||||
{% endblock %}
|
||||
{% block artifact %}${builddir}/{{ module.output }} : exe{% endblock %}
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends "target.default.ninja.j2" %}
|
||||
{% extends "target.default.j2" %}
|
||||
|
||||
{% block binaries %}
|
||||
ld = ld
|
||||
@@ -13,5 +13,5 @@ objcopy = objcopy
|
||||
{% endblock %}
|
||||
|
||||
{% for module in modules %}
|
||||
subninja {{ module }}.ninja
|
||||
subninja {{ module.name }}.ninja
|
||||
{% endfor %}
|
||||
@@ -1,4 +1,5 @@
|
||||
{% extends "target.default.ninja.j2" %}
|
||||
{% extends "target.default.j2" %}
|
||||
|
||||
{% block binaries %}
|
||||
cc = ${srcroot}/sysroot/bin/clang
|
||||
cxx = ${srcroot}/sysroot/bin/clang++
|
||||
@@ -1 +0,0 @@
|
||||
{% extends "target.default.ninja.j2" %}
|
||||
Reference in New Issue
Block a user