-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP to export Makefiles that replace include with file content #39
Conversation
This spike is to transpile makefiles to replace include statements with their file contents.
"github.com/tj/mmake/help" | ||
"github.com/tj/mmake/installer" | ||
"github.com/tj/mmake/resolver" | ||
) | ||
|
||
var makefileVariants = [3]string{"GNUmakefile", "makefile", "Makefile"} | ||
var makefileVariants = [3]string{"GNUmakefile", "Makefile", "makefile"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching this order due to case-insensitive file systems (OSX :-/) finding the less common naming of file first.
} | ||
|
||
func IncludedMakefilePaths(path string) []string { | ||
stubMakefile := fmt.Sprintf(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trick to get full paths of all included files.
So the current
|
This spike is to transpile makefiles to replace include statements with
their file contents.
This will solve 2 issues:
include
makefiles (Issue mmake help doesn't output comments from include targets #31)I spiked it out in ruby for easy of scripting: https://gist.github.com/zph/8b3f6afd7a56613a80ef09319c20c7be
mmake export
will read the Makefile, then parse it line by line for include statements, then each include will be recursively filled in with the file content of theinclude
Makefile, which will be recursively parsed for include statements...So running
mmake export
on the Makefile at root of this project would yield a portable Makefile like:That full Makefile output can then be used for
mmake help
to correctly report all targets :D.Anyway, it looked fun and caught my attention. Now I need to do the actual work of transcribing and re-implementing.