Go to the first, previous, next, last section, table of contents.

Pattern rules and options

The file `suffix.mk' defines standard pattern rules that say how to build one kind of file from another, for example, how to build a `.o' file from a `.c' file. (GNU `make''s pattern rules are more powerful and easier to use than Unix `make''s suffix rules.)

Almost all the rules look something like this:

%.o : %.c
        @$(RM) $@
        $(CC) $(CC_OPTS) -c $< -o $@
Here's how to understand the rule. It says that something.o (say `Foo.o') can be built from something.c (`Foo.c'), by invoking the C compiler (path name held in `$(CC)'), passing to it the options `$(CC_OPTS)' and the rule's dependent file of the rule `$<' (`Foo.c' in this case), and putting the result in the rule's target `$@' (`Foo.o' in this case).

Every program is held in a `make' variable defined in `mk/config.mk' -- look in `mk/config.mk' for the complete list. One important one is the Haskell compiler, which is called `$(HC)'.

Every programs options are are held in a `make' variables called `<prog>_OPTS'. the `<prog>_OPTS' variables are defined in `mk/opts.mk'. Almost all of them are defined like this:

  CC_OPTS = $(SRC_CC_OPTS) $(WAY$(_way)_CC_OPTS) $($*_CC_OPTS) $(EXTRA_CC_OPTS)
The four variables from which `CC_OPTS' is built have the following meaning:
`SRC_CC_OPTS':
options passed to all C compilations.
`WAY_<way>_CC_OPTS':
options passed to C compilations for way `<way>'. For example, `WAY_mp_CC_OPTS' gives options to pass to the C compiler when compiling way `mp'. The variable `WAY_CC_OPTS' holds options to pass to the C compiler when compiling the standard way. (Section See section Way management dicusses multi-way compilation.)
`<module>_CC_OPTS':
options to pass to the C compiler that are specific to module `<module>'. For example, `SMap_CC_OPTS' gives the specific options to pass to the C compiler when compiling `SMap.c'.
`EXTRA_CC_OPTS':
extra options to pass to all C compilations. This is intended for command line use, thus;
  gmake libHS.a EXTRA_CC_OPTS="-v"


Go to the first, previous, next, last section, table of contents.