-
Notifications
You must be signed in to change notification settings - Fork 0
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
Build system organization and documentation #21
Conversation
Now the top-level Build.mk is responsible for creating the build directory, meaning it can be included from other Makefiles (even ones beyond the source tree).
Wow I really butchered this PR title. Hopefully this new one clarifies things a little more. This PR now includes commits toward #12, by allowing the top-level Build.mk to be included from outside of this project. I would like to close that issue in this PR, as long as I don't hit any snags (even if that oversteps the original intention of this PR, which was primarily to provide better documentation and organization). Will update the top comment with a TODO list for myself |
Maybe I'm trying to knock down too many issues with this "documentation" PR, but it looks like I have the beginnings of a solution for #12 in here too (which I will summarily document as that finalizes). Sorry for the lack of focus in this PR. |
edsl/Cli.hs
Outdated
, transpile | ||
) | ||
|
||
compileCli :: SSM () -> IO () |
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.
With this, one can write an SSM program like this:
-- in MyFn.hs
import SSM
import Cli (compileCli)
myfn :: SSM ()
myfn = ...
-- | boilerplate to compile myfn to file
main :: IO ()
main = compileCli myfn
and "invoke" the compiler as follows:
stack --stack-yaml /path/to/ssm-edsl/stack.yaml runghc MyFn.hs
which will write the compiled C program to myfn.c
(using the entry point of program to derive the C filepath). It also supports the argument -o
to explicitly specify the filepath:
stack --stack-yaml /path/to/ssm-edsl/stack.yaml runghc MyFn.hs -- -o mycustomname.c
This allows us to easily write a Make rule for it, something like:
%.c: %.hs
stack --stack-yaml $(SSMDIR)/stack.yaml runghc $< -- -o $@
Backend build system documentation not yet complete
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.
It looks great! Nice documentation for the test & build setup.
I realize that I didn't leave behind much top-level documentation, and there's some additional cleanup/touch ups I'd like to add to this.
Not ready for merging at time of writing; I'll indicate when it is.