Cleanup DMD as a library build files#7418
Conversation
- Allow them to be directly executable (via the DMD DUB package) - Add a wild rule to avoid redundant logic - Remove irrelevant link flags like `-L-lstd++` - Move example binaries to the generated directory - Start building the examples on auto-tester (Posix-only for now) - Make Phobos path in impvisitor example more robust
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
| PARSER_SRCS=$(addsuffix .d, $(addprefix $D/,parse astbase parsetimevisitor transitivevisitor permissivevisitor strictvisitor)) | ||
|
|
||
| $G/parser.a: $(PARSER_SRCS) $(LEXER_SRCS) $(ROOT_SRCS) $G/dmd $(SRC_MAKE) | ||
| CC="$(HOST_CXX)" $G/dmd -lib -of$@ $(MODEL_FLAG) -L-lstdc++ -J$G $(DFLAGS) $(PARSER_SRCS) $(LEXER_SRCS) $(ROOT_SRCS) |
There was a problem hiding this comment.
FYI: the existing parser.a target is only needed to build the examples
c43e76f to
47e6b5f
Compare
|
A more general issue - with every PR, I suspect there is a nice makefile in there somewhere trying to get out. |
I never understood why we use something as arcane as |
See e.g. http://forum.dlang.org/post/mailman.3317.1497594616.31550.digitalmars-d@puremagic.com tl;dr: this pops up every three to six months. The main problem is DM make on Windows which creates a huge chunk of duplication (it's especially bad for Phobos) as it only supports a limited subset of GNUmake. |
|
@wilzbach The examples weren't meant to test the parser library, but to offer an example on how the parser visitors can be used. I don't think that moving the sources to the test files is a good idea since those aren't actually tests. I don't have any other objections regarding this PR |
Point being was that the examples currently aren't built as part of the test suite, which can easily lead to them being in a broken / outdated state (like e.g. the DUB package which already doesn't work anymore - see #7415).
Well my point was to move them out of the main Makefile, s.t. the "nice Makefile" can slowly start to appear again ;-) |
A few things I found when working on #7415 and looking at the examples for DMD as a library:
-L-lstd++I think this is the coolest bit is that the examples for having DMD as a library are executable via DUB. This also means that we could drop them from the
posix.makandwin32.makaltogether, could move them to a different directory (e.g. the test suite orsamples) and don't need to worry about writing any cross-platform Makefiles as DUB takes care of this.CC @RazvanN7