another Makefile fix

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


> Sorry: I meant the old Makefile.
> As to the Makefile hack, if the only point is to be able to make mlton.cm, then
> I would vote (not strongly) to just have a separate file (make-cm or something
> like that) which makes mlton.cm.  This seems better to me then the DWIM'ishness
> in the Makefile where it isn't clear what cases it can handle and which ones
> it can't.
> I.e., no Makefiles make any .cm files and there is a separate executable which
> you run when you know that hte .cm file has to be remade (and, I suppose, it
> depends on either cmcat or mlton -f).

One last try:

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

Now, I claim, make mlyacc.cm is equivalent to Henry's make-cm and make ???
(where ??? <> mlyacc.cm) is equivalent to make ??? with no reference to
the mlyacc.cm target in the makefile.

> Note, this will fail if the person does
>         make some-target mlyacc.cm some-other-target
> and the like.

This will now fail differently.  Unless mlyacc.cm is the only target, then
it won't be a valid target.  So the above would fail, which I think is
appropriate.