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

The main `mk/target.mk' file

`target.mk' contains canned rules for all the standard targets described in Section See section Standard targets. It is complicated by the fact that you don't want all of these rules to be active in every `Makefile'. Rather than have a plethora of tiny files which you can include selectively, there is a single file, `target.mk', which selectively includes rules based on whether you have defined certain variables in your `Makefile'. This section explains what rules you get, what variables control them, and what the rules do. Hopefully, you will also get enough of an idea of what is supposed to happen that you can read and understand any wierd special cases yourself.

`HS_PROG'.
If `HS_PROG' is defined, you get rules with the following targets:
`HS_PROG'
itself. This rule links `$(OBJS)' with the Haskell runtime system to get an executable called `$(HS_PROG)'.
`install'
installs `$(HS_PROG)' in `$(bindir)' with the execute bit set.
`C_PROG'
is similar to `HS_PROG', except that the link step links `$(C_OBJS)' with the C runtime system.
`LIBRARY'
is similar to `HS_PROG', except that it links `$(LIB_OBJS)' to make the library archive `$(LIBRARY)', and `install' installs it in `$(libdir)', with the execute bit not set.
`LIB_DATA'
...
`LIB_EXEC'
...
`HS_SRCS', `C_SRCS'.
If `HS_SRCS' is defined and non-empty, a rule for the target `depend' is included, which generates dependency information for Haskell programs. Similarly for `C_SRCS'.

All of these rules are "double-colon" rules, thus

  install :: $(HS_PROG)
        ...how to install it...
GNU `make' treats double-colon rules as separate entities. If there are several double-colon rules for the same target it takes each in turn and fires it if its dependencies say to do so. This means that you can, for example, define both `HS_PROG' and `LIBRARY', which will generate two rules for `install'. When you type `gmake install' both rules will be fired, and both the program and the library will be installed, just as you wanted.


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