added general prefab make targets and misc tidying

This commit is contained in:
Eric Froemling 2019-10-15 10:14:34 -07:00
parent 97dac7138c
commit 66693c11d1
3 changed files with 84 additions and 43 deletions

View File

@ -28,42 +28,6 @@
# Prefix used for output of docs/changelogs/etc targets for use in webpages.
DOCPREFIX = "ballisticacore_"
# Print help by default
all: help
# Tell make which of these targets don't represent files.
.PHONY: all
################################################################################
# #
# Prefab #
# #
################################################################################
# Prebuilt binaries for various platforms.
prefab-mac: prefab-mac-build
@cd build/prefab/mac/debug && ./ballisticacore
prefab-mac-build: assets-cmake build/prefab/mac/debug/ballisticacore
@${STAGE_ASSETS} -cmake build/prefab/mac/debug
build/prefab/mac/debug/ballisticacore: .efrocachemap
@tools/snippets efrocache_get $@
prefab-mac-release: prefab-mac-release-build
@cd build/prefab-mac/release && ./ballisticacore
prefab-mac-release-build: assets-cmake build/prefab/mac/release/ballisticacore
@${STAGE_ASSETS} -cmake build/prefab/mac/release
build/prefab/mac/release/ballisticacore: .efrocachemap
@tools/snippets efrocache_get $@
# Tell make which of these targets don't represent files.
.PHONY: prefab-mac prefab-mac-build prefab-mac-release prefab-mac-release-build
################################################################################
# #
@ -77,12 +41,9 @@ PREREQS = .dir-locals.el .mypy.ini .pycheckers \
.pylintrc .style.yapf .clang-format \
.projectile .editorconfig
# List the targets in this Makefile and basic descriptions for them.
list:
@tools/snippets makefile_target_list Makefile
# Same as 'list'
# List targets in this Makefile and basic descriptions for them.
help: list
@tools/snippets makefile_target_list Makefile
prereqs: ${PREREQS}
@ -151,6 +112,54 @@ cleanlist:
clean cleanlist
################################################################################
# #
# Prefab #
# #
################################################################################
# Prebuilt binaries for various platforms.
# Download/assemble/run a debug build for this platform.
prefab:
@tools/snippets make_prefab debug
# Download/assemble/run a release build for this platform.
prefab-release:
@tools/snippets make_prefab release
# Download/assemble a debug build for this platform.
prefab-build:
@tools/snippets make_prefab debug-build
# Download/assemble a release build for this platform.
prefab-release-build:
@tools/snippets make_prefab release-build
# Specific platform prefab targets:
prefab-mac: prefab-mac-build
@cd build/prefab/mac/debug && ./ballisticacore
prefab-mac-build: assets-cmake build/prefab/mac/debug/ballisticacore
@${STAGE_ASSETS} -cmake build/prefab/mac/debug
build/prefab/mac/debug/ballisticacore: .efrocachemap
@tools/snippets efrocache_get $@
prefab-mac-release: prefab-mac-release-build
@cd build/prefab/mac/release && ./ballisticacore
prefab-mac-release-build: assets-cmake build/prefab/mac/release/ballisticacore
@${STAGE_ASSETS} -cmake build/prefab/mac/release
build/prefab/mac/release/ballisticacore: .efrocachemap
@tools/snippets efrocache_get $@
# Tell make which of these targets don't represent files.
.PHONY: prefab-mac prefab-mac-build prefab-mac-release prefab-mac-release-build
################################################################################
# #
# Formatting / Checking #

View File

@ -421,7 +421,7 @@ def makefile_target_list() -> None:
print('--------------------------\n'
'Available Makefile Targets\n'
'--------------------------\n')
'--------------------------')
entries: List[_Entry] = []
for i, line in enumerate(lines):
@ -438,8 +438,11 @@ def makefile_target_list() -> None:
entries.append(
_Entry(kind='section', line=i, title=line[1:-2].strip()))
for entry in entries:
for i, entry in enumerate(entries):
if entry.kind == 'section':
# Don't print headers for empty sections.
if i + 1 >= len(entries) or entries[i + 1].kind == 'section':
continue
print('\n' + entry.title + '\n' + '-' * len(entry.title))
elif entry.kind == 'target':
print(CLRHDR + entry.title + CLRBLU + _docstr(lines, entry.line) +

View File

@ -649,5 +649,34 @@ def warm_start_asset_build() -> None:
check=True)
def make_prefab() -> None:
"""Run prefab builds for the current platform."""
from efrotools import run
import platform
if platform.system() == 'Darwin':
base = 'mac'
else:
raise RuntimeError('Prefab not supported on this platform.')
if len(sys.argv) != 3:
raise RuntimeError('Expected one argument')
arg = sys.argv[2]
if arg == 'debug':
target = f'prefab-{base}'
elif arg == 'debug-build':
target = f'prefab-{base}-build'
elif arg == 'release':
target = f'prefab-{base}-release'
elif arg == 'release-build':
target = f'prefab-{base}-release-build'
else:
raise RuntimeError(f'Invalid target: {arg}')
run(f'make {target}')
if __name__ == '__main__':
snippets_main(globals())