failure
Stephen Weeks
MLton@sourcelight.com
Wed, 3 Oct 2001 11:21:40 -0700
> The reason is that the Makefile re-made src/yacc.lex.sml and friends, and so
> since mlyacc.cm depends on them, it had to be re-made to.
> The reason is that src/yacc.lex.sml wasn't part of the source, so it must be
> made.
We've had this problem with mlton/Makefile and mlyacc/Makefile
forever. Matthew summarizes the problem in his checking to revision
1.3 of mlyacc/Makefile. The problem comes from the following
statements, which are conflicting
1. we don't want to depend on others having cmcat.
2. cmcat generates mlyacc.cm from sources.cm.
3. mlyacc.cm is generated, and should not be part of the source.
4. yacc.lex.sml is generated, and should not be part of the source.
5. sources.cm mentions yacc.lex.sml.
6. cmcat failes if any of the files in sources.cm do not exist.
(1), (2), and (3) obviously conflict, because if we don't include
mlyacc.cm in source, then whoever does a make must have cmcat. We
decided to resolve this conflict in favor of (1), and include
mlyacc.cm in the source.
(1), (4), (5), and (6) also conflict, in a nontrivial way. Because of
(5) and (6), the Makefile expresses the dependence of mlyacc.cm on
yacc.lex.sml. Because of (4), if someone does a clean make, then
yacc.lex.sml generated. Hence, if someone does a clean make,
mlyacc.cm needs to be remade, which conflicts with (1). We
(mistakenly, IMO) resolved this conflict in favor of (4), (5), and
(6).
It's silly for us to choose one way in the first conflict and the
other in the second conflict. I still think (1) is worthwhile, and
would like to resolve the second conflict in its favor. We could
either drop (4) or the Makefile dependence that follows from (5) and
(6). I lean slightly towards dropping the Makefile dependence, and
instead rewriting the Makefile as follows.
$(NAME): src/yacc.lex.sml src/yacc.grm.sig src/yacc.grm.sml \
$(NAME).cm $(shell $(MLTON) -stop f $(NAME).cm)
@echo 'Compiling $(NAME)'
time $(MLTON) $(FLAGS) $(NAME).cm
strip $(NAME)
size $(NAME)
$(NAME).cm: sources.cm
( \
echo 'Group is' && \
cmcat sources.cm | grep -v 'mlton-stubs-in-smlnj' && \
echo 'call-main.sml'; \
) >$(NAME).cm
This will hopefully make stuff in the right order.
I am happy to hear other thoughts.