failure

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 3 Oct 2001 14:53:14 -0400 (EDT)


> 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.

My initial objection to this is that it takes multiple steps to really get
mlton.cm up-to-date.  For example, suppose I have clean sources and I
add new .sig/.sml files to x86-codegen/sources.cm.  If I go to /src/mlton
and type make mlton.cm, nothing happens because sources.cm hasn't changed.
So I delete mlton.cm and type make mlton.cm, and it fails because
front-end/ml.grm.sml and friends aren't made.  So, I guess I would do the
following, for mlyacc.cm and similarly for mlton.cm

$(NAME).cm:
	make src/yacc.lex.sml &&		\
	make src/yacc.grm.sig &&		\
	make src/yacc.grm.sml &&		\
 	(								\
 		echo 'Group is' &&					\
 		cmcat sources.cm | grep -v 'mlton-stubs-in-smlnj' &&	\
 		echo 'call-main.sml';					\
 	) >$(NAME).cm

Drop the dependency on sources.cm because (1) we're going to have to do an
explicit make mlton.cm when we know we need to and (2) 99.99% of the time
/src/mlton/sources.cm is not going to have changed.

Keep the dependency on generated files unstated, but enforce it before
getting to cmcat which will require their existence.