I have a project using Makefile; I don’t want to learn HyperMake. But building in container is very appealing to me.
hmake provides a special wrapper mode for legacy projects.
echo '#hmake-wrapper gcc:4.9' >HyperMake
Now hmake becomes a wrapper of make
hmake target1 target2
is equivalent to
make target1 target2
but inside a container created from gcc:4.9
.
In wrapper mode, HyperMake may contain one or more lines. The first line has specific format:
#hmake-wrapper IMAGE [BUILD-FROM] [BUILD-ARG1] [BUILD-ARG2] ...
It must start with #hmake-wrapper
,
and IMAGE
is required to specify a docker image.
BUILD-FROM
is optional, when present, hmake will create a toolchain
target
to build toolchain image for rest of other targets.
It specifies the location of Dockerfile.
And the rest of parameters are interpreted as --build-args
for docker build
.
If there’s only one line, hmake will invoke make
with command line arguments.
If there’re more lines:
#!
,
all lines from second line are copied as a script,
and hmake invokes this script as build
target;#!
,
a line #!/bin/sh
plus all lines from second line are copied as a script,
and hmake executes the script.Wraps over make
#hmake-wrapper gcc:4.9
Wraps over a python script
#hmake-wrapper python:2.7
#!/usr/bin/env python
print 'Hello'
Wraps over a shell script
#hmake-wrapper busybox
echo Hello