Jack Kelly
unread,May 13, 2012, 6:30:22 PM5/13/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fp-...@googlegroups.com
Hi Robert,
I can't comment meaningfully about the language design itself, but if
you're looking to build an ahead-of-time compiler, may I make some
suggestions?
The way I see it, if your new compiler can't play nice with make(1),
it's going to be very hard for it to gain traction. To do that, I
propose the following:
#1: You're almost certainly going to have object files that depend on
more than just the source file (be it headers, other module
interfaces, whatever). Therefore, any compiler should have an option
to produce makefile fragments describing the dependencies. See the -M
-MM -MD -MMD -MF -MG -MP -MT -MQ options to gcc(1). You may also want
to output this metadata in a more modern format for other build tools
to consume (sexp? json?).
#2: Your compiler should have options to produce files one at a time.
O'Caml is a particularly bad offender, where compiling a .ml can
produce .cmo, .cmi, .cmx and .o files depending on whether you use
ocamlc or ocamlopt and whether or not you've got a separate .mli file.
make's not good at handling multiple output files, and although you
can do it with GNUmake's pattern rules, I would recommend something
that works with across other makes. Making it easy to use across all
makes means automake users can add it to their build systems
relatively easily.
#3: Despite #2, the compiler should be able to compile and link a
standalone program in one invocation. It should also be able to
compile a source file into an object and associated metadata in a
single invocation. Compiling and linking with a single command makes
getting started easier, and you want something that people can pick
up. Having the option to compile (to an object), generate dependencies
and metadata in a single invocation means that when the glorious
revolution of modern build tools comes around (that is, something that
doesn't just spit out makefiles), you'll be ready.
I hope that's some use. Build systems are a pet topic of mine.
-- Jack