File: components2defs.py

package info (click to toggle)
openmsx 20.0%2Bdfsg-1.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,544 kB
  • sloc: cpp: 236,922; xml: 49,948; tcl: 15,056; python: 5,385; perl: 281; sh: 77; makefile: 53
file content (39 lines) | stat: -rw-r--r-- 1,071 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Generates the contents of "components_defs.mk".

from components import (
	EmulationCore, iterBuildableComponents, iterComponents,
	requiredLibrariesFor
	)
from makeutils import extractMakeVariables
from outpututils import rewriteIfChanged

import sys

def iterComponentDefs(probeMakePath):
	probeVars = extractMakeVariables(probeMakePath)

	yield '# Automatically generated by build process.'
	yield ''

	yield 'LIBRARY_COMPILE_FLAGS:='
	yield 'LIBRARY_LINK_FLAGS:='
	for libName in requiredLibrariesFor(iterBuildableComponents(probeVars)):
		yield '# %s' % libName
		yield 'LIBRARY_COMPILE_FLAGS+=' + probeVars.get(libName + '_CFLAGS', '')
		yield 'LIBRARY_LINK_FLAGS+=' + probeVars.get(libName + '_LDFLAGS', '')
	yield ''

	for component in iterComponents():
		yield 'COMPONENT_%s:=%s' % (
			component.makeName,
			str(component.canBuild(probeVars)).lower()
			)

if len(sys.argv) == 3:
	rewriteIfChanged(sys.argv[1], iterComponentDefs(sys.argv[2]))
else:
	print(
		'Usage: python3 components2defs.py COMPONENTS_DEFS PROBE_MAKE',
		file=sys.stderr
		)
	sys.exit(2)