It's a simple task, but I'm not up on my CLI tools, so I went with Python instead of sh. The split command doesn't have '-p' switch on Ubuntu. (I'm using Ubuntu on this laptop because it can correctly configure the WiFi and the laptop has no ethernet port.)
14 lines
360 B
Makefile
14 lines
360 B
Makefile
SHELL != which python
|
|
.ONESHELL:
|
|
|
|
joy: joy.py ../defs.txt
|
|
from pathlib import Path
|
|
SPLIT_PATTERN = "'''.splitlines()\n"
|
|
joy_source = Path('joy.py').read_text()
|
|
defs_source = Path('../defs.txt').read_text()
|
|
head, sep, tail = joy_source.partition(SPLIT_PATTERN)
|
|
joy = Path('joy')
|
|
joy.write_text(''.join((head, defs_source, sep, tail)))
|
|
joy.chmod(0o775)
|
|
|