This commit is contained in:
Brad Nelson
2024-01-01 16:47:01 -08:00
parent 8987068dac
commit b5ee992a86

View File

@ -127,6 +127,8 @@ WIN_RC64 = LSQ(MSKITS + '/*/bin/*/x64/rc.exe')
D8 = LSQ('${HOME}/src/v8/v8/out/x64.release/d8') D8 = LSQ('${HOME}/src/v8/v8/out/x64.release/d8')
NODEJS = LSQ('/usr/bin/nodejs') NODEJS = LSQ('/usr/bin/nodejs')
build_files = []
output = f""" output = f"""
ninja_required_version = 1.1 ninja_required_version = 1.1
src = . src = .
@ -153,6 +155,10 @@ WIN_CFLAGS = {' '.join(WIN_CFLAGS)}
WIN_LFLAGS32 = {' '.join(WIN_LFLAGS32)} WIN_LFLAGS32 = {' '.join(WIN_LFLAGS32)}
WIN_LFLAGS64 = {' '.join(WIN_LFLAGS64)} WIN_LFLAGS64 = {' '.join(WIN_LFLAGS64)}
rule config
description = CONFIG
command = $src/configure.py -q
rule importation rule importation
description = importation description = importation
depfile = $out.d depfile = $out.d
@ -233,10 +239,16 @@ rule forth_test
rule clean rule clean
description = CLEAN description = CLEAN
command = ninja -t clean command = rm -rf $dst/
build clean: clean build clean: clean
rule all_clean
description = ALL_CLEAN
command = rm -rf $dst/ && rm build.ninja
build allclean: all_clean
""" """
@ -382,6 +394,7 @@ def Default(target):
def Include(path): def Include(path):
build_files.append(os.path.join(path, 'BUILD'))
path = os.path.join(ROOT_DIR, path, 'BUILD') path = os.path.join(ROOT_DIR, path, 'BUILD')
data = open(path).read() data = open(path).read()
exec(data) exec(data)
@ -392,10 +405,14 @@ def Main():
prog='configure', prog='configure',
description='Generate ninja.build') description='Generate ninja.build')
parser.add_argument('-o', default='build.ninja') parser.add_argument('-o', default='build.ninja')
parser.add_argument('-q', '--quiet', action='store_true')
args = parser.parse_args() args = parser.parse_args()
Include('.') Include('.')
with open(args.o, 'w') as fh: with open(args.o, 'w') as fh:
fh.write(output) fh.write(output)
fh.write(f'build {args.o}: config ./configure.py ' + ' '.join(build_files) + '\n')
if not args.quiet:
print('TO BUILD RUN: ninja')
if __name__ == '__main__': if __name__ == '__main__':