failure

Matthew Fluet fluet@CS.Cornell.EDU
Wed, 3 Oct 2001 16:10:42 -0400 (EDT)


> >  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
> ...
> I am happy with this.

Even better.  (The problem with the above is that make mlyacc.cm doesn't
really force mlyacc.cm to be remade.)

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

Now, an explicit make mlyacc.cm will work.  The .PHONY forces the file 
to be remade even though it exists, and the dependencies allow make to 
generate the files without an explicit recursive invocation of
$(MAKE).

If this sounds good, I'll check them in.