-
Notifications
You must be signed in to change notification settings - Fork 17
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
Misc/makefile improvements #171
Misc/makefile improvements #171
Conversation
`Cli` => `CLI`
Makefile now only builds if there as been any changes to the relevant files. `make spec` will build `bin/spec` (if not otherwise specified) and run it; if it were to be run again with no changes to any files made, `bin/spec` will be reused. `make help` also looks much much better.
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.
Really nice overall! Left a few comments to address, but other than that I'm ready to merge. Thanks for working on this! :)
Makefile
Outdated
check: ## Runs all crystal specs | ||
crystal spec/ | ||
# The docs says i should do this | ||
.SUFFIXES: .cr .mt |
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.
Take a look at https://stackoverflow.com/a/2011058 for why this is useful. A comment like "ensure that only .cr
and .mt
files can have suffix rules." would be a bit better, but I honestly don't think it's needed here (we're not converting files between types, so we don't need suffix rules, etc.)
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.
I see! So that's what it was for 😅
Makefile
Outdated
help: ## Show this help. | ||
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | ||
MYST_INTERPRETER_SPEC = spec/all_spec.cr | ||
MYST_IN_LANG_SPEC = spec/myst/spec.mt |
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.
spaces please :)
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.
Oh my, will do
Makefile
Outdated
INSTALL_LOCATION ?= /usr/local/bin/myst | ||
MYSTBUILD ?= myst | ||
|
||
O ?= bin |
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.
Is O
supposed to represent the "object" directory? I'm not a fan of single character names, so I'd like it if this could be expanded to something more descriptive, or at least have a comment about what it represents.
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.
O
is supposed to represent 'out', i'll just change it to that, this is how crystal's makefile does it, so I just thought they knew best. But, I agree
Makefile
Outdated
$(O)/myst: $(SOURCE_FILES) | ||
$(call info_log,Building myst...) | ||
mkdir -p $(O) | ||
crystal build -o $(O)/myst $(MYST_CLI) |
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.
I think using shards build
for this might be more consistent, rather than relying on $(O)
to point to the right place. Not a requirement, just a thought :)
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.
I thought about that. OUT
(which is what i'll change O
to) can be set like this make build OUT=.../somewhere
, so im pretty sure OUT
will be the right place, and $(OUT)/myst
is required to be a file for the $(SOURCE_FILES)
dependency to work.
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.
So if you want shards build
then just use shards build
, not make build
is my point. :)
Makefile
Outdated
STDLIB_FILES := $(shell find stdlib -type f -name '*.mt') | ||
ALL_FILES := $(SPEC_FILES) $(STDLIB_FILES) $(SOURCE_FILES) | ||
|
||
INSTALL_LOCATION ?= /usr/local/bin/myst |
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.
Can this default to something like myst-local
instead of just myst
? I don't want it to conflict with other installations the user might have (e.g., through homebrew).
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.
My thoughts was just that we could use this in the actual homebrew installation though (e.g. system "make", "install"
).
- O changed to OUT - Tabs changed to spaces where possible (i.e. not targets) - Removed .SUFFIXES as it was useless - Fixed problem that made the .DEFAULT_GOAL example would not work
What I am most happy with is actually the
|
Actually don't merge just yet, realized there was no goal of running just the interpreter specs 😅 |
There, now it should be all set for a merge |
Awesome! Thank you, and nicely done :) |
Makefile now only builds if there as been any changes to the relevant files.
make spec
will buildbin/spec
(if not otherwise specified) and run it; if it were to be run again with no changes to any files made,bin/spec
will be reused.make help
also looks much much better.