-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Makefile: Allow to add EXTRA_FLAGS to FLAGS #5860
Conversation
Why not rename it By default |
Makefile
Outdated
@@ -27,7 +27,7 @@ static ?= ## Enable static linking | |||
O := .build | |||
SOURCES := $(shell find src -name '*.cr') | |||
SPEC_SOURCES := $(shell find spec -name '*.cr') | |||
FLAGS := $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" ) | |||
FLAGS := $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" ) $(EXTRA_FLAGS) |
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.
Would it not to be better to just do something like
override FLAGS += $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )
That way specifying make all FLAGS=--totally-existant-flag
would just prepend --totally-existant-flag
to the old FLAGS. And you wouldn't have to type the extra EXTRA_
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.
Yeah thats what I meant, I should learn more 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.
That way specifying
make all FLAGS=--totally-existant-flag
would just prepend--totally-existant-flag
to the old FLAGS. And you wouldn't have to type the extraEXTRA_
That indeed an option, but it would not be backward compatible – now you can completely override FLAGS
. If Crystal maintainers are okay with this change of behaviour, I’ll change it to the suggested variant.
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 had the same concern at first but then there are actually no default values in FLAGS
, all depend on another variable being set. So previously specifying FLAGS
and for example release
didn't work, you already had to do FLAGS=--release --whatever
, which will continue to work just the same. Only if you would have specified release=1 FLAGS=--release
there would be a slight change, but that was kinda invalid previously already.
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 my suggested change, make all release=1 FLAGS=--no-debug
would build with the flags --no-debug --release
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.
@Jens0512 Is override
really necessary? I think that FLAGS += …
should work too; what difference does it make?
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.
@jirutka Override is absolutely necessary
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.
@jirutka See RX14s, and my comment for why.
746da81
to
2a5fc6b
Compare
From the make docs. This change currently actually does nothing, as |
@jirutka Without |
As to the suggestion to rename |
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.
This does absolutely nothing. An override
is needed.
@jirutka ping? If you don't have time for this I can do it myself. |
2a5fc6b
to
21d0a18
Compare
21d0a18
to
0e4346c
Compare
Sorry for delay, I’ve updated it now. |
No description provided.