lazbuild --create-makefile project1.lpi
lazbuild project1.lpi --create-makefile
Everything is clear to me, but you doubted it)) There is only one command ("action") in the line, and there are no ambiguities.
My project is named --create-makefile the second project is named project1.lpi
This problem affects any command line. If you want to use a filename starting with "
-" or "
--", then just put it in quotes. It is good practice to quote any name at all, even if it does not contain spaces or other special characters.
I wish to build project1.lpi and based on the project settings create a makefile as well so that next time I can use make (or fpmake) instead of lazbuild.
For these purposes, Martin suggested:
Btw, about the idea with multiple commands, something like this would work (and probably even be compatible with what we currently have, at least so long as current syntax has one action only
lazbuild [options for all actions] ACTION-1 [options for action 1 only] ACTION-2 [options for action 2 only]
Yes of course that can be done with the --get-.. --update-... style. But that be really bad...
There could be a divider between actions
lazbuild [options for all actions] -+- [options for action 1 only] ACTION-1 [options for action 1 only] -+- ACTION-2 [options for action 2 only]
Neither needs to be decided yet. If for now, the rule is: only one action, then both of the above will be backward compatible, if ever we would want them.
It seems to me that the only purpose that can be achieved with this syntax is to increase execution speed so that the file does not have to be reopened for each command. But it’s unlikely that
lazbuild spends a lot of time on this.
And what if an error occurs on some "action"? How to find out which one? And is it necessary to continue working after this? And how can I find out which project is currently being compiled with messages? This will force you to add several more flags, making the syntax even more complex.
I think that for
lazbuild this is not necessary.
One line - one command. This is a command line interface - it should be simple so that it can be
easily used in scripts.
By the way, this reminded me of the syntax of the "make" utility. At first I didn’t understand why the phrase "clean all" is always used for building ))
And why would there be need to include a template parser in lazbuild itself ? There are plenty enough 3th party template parsers so all lazbuild need to do is pipe the defines/vars to something suitable (hence my mentioned preference for a separate command that does not add unnecessary bloat to lazbuild. The bloat is one thing but it also has to be maintained.
This is not just parsing. Expanding macros is a more complex task, all the subtleties of which are unlikely to be known to a third-party application.
And
lazbuild already does this, so there won't be any bloat and support for this particular feature won't be needed. Check out the original merge request:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/129Getting the macro value is one line, everything else concerns command line parsing.