mage is a makefile-replacement that uses go instead of bash as the programming language
One of the benefits of using go is that it is cross platform. Currently, hugo's makefile won't work on windows without jumping through some hoops.
In addition, having the build script written in go means that it's more friendly to contributors who already know go, but might be intimidated by lines like this -
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
I think it would be pretty easy to port Hugo's makefile to mage. I'd be happy to provide PR doing this, if the maintainers think it's a good idea.
I think it is a good idea.
You can maybe let this issue linger for, say, 2 days before starting working on a PR to let the others chime in.
But we have had plenty of build related questions here and on the forum, so getting a solid and reproducible cross-platform way of building and testing this would be great.
/cc @spf13 @moorereason @anthonyfok @digitalcraftsman
Great, happy to hear people's thoughts.
That sounds indeed like a good idea @natefinch . While I'm happy with the current Makefile I can understand that not all people (incl. me) are bash wizards like @bep.
Users that intend to contribute to the Hugo code base have Go already installed and will be more or less familiar with it. So it shouldn't introduce a new barrier. :+1: for platform independence as well.
Intriguing!
I'd say it is interesting and useful enough, so I'd say: Yes, please go ahead!
I do have one request though: Please do keep the Makefile so that the end users have the freedom to choose his/her favourite tool to use, and so as not to break any existing automated script that runs make to call the Makefile.
I'm not sure how much package maintainers like @anthonyfok depend on the Makefile. But the switch should definitely be highlighted in the next release. At least on Arch-based distros it's not unusual to compile the binaries during the installation.
I'm not sure how much package maintainers like @anthonyfok depend on the Makefile
Good question! From a cursory look at my Hugo 0.26 Debian build log, it would appear that the Makefile wasn't used at all! The debhelper dh_golang tool calls go directly by default, which I hadn't overriden.
@anthonyfok so, about keeping both... I don't think there should have two ways to build Hugo. That will just cause confusion and increase maintenance costs, since fixes/changes to the build process would then have to be done to both systems. That kind of defeats the purpose of having the build system accessible to contributors that aren't bash gurus.
Well @natefinch a decent way to phase out would be:
1 ) Build equivalent functionality with mage.
2) Add a warning to the Makefile targets.
1) Remove the Makefile
2) Add a message somewhere visible that reads: Looking for Makefile? with the right info.
Great idea, @perrito666
@natefinch I checked around a little, and all the "important external parties" (i.e. brew...) do not use the make file in Hugo. That leaves some stuff in the Hugo project itself:
The above should be easily rewritten to use mage.
One of the big benefits of doing this is to get something simpler; and that mean replacing and not just adding
So: We do a rm Makefile as part of this operation.
And I see lots of "this sounds good" above, so a PR that just "does this" is welcomed.
great. I'll get one ready.
So the makefile still exists. Is there a plan to phase that out, or are we keeping both?