PMake allows you to give attributes to targets by means of special sources. Like everything else PMake uses, these sources begin with a period and are made up of all upper-case letters. There are various reasons for using them, and I will try to give examples for most of them. Others you will have to find uses for yourself. Think of it as “an exercise for the reader”. By placing one (or more) of these as a source on a dependency line, you are “marking the target(s) with that attribute”. That is just the way I phrase it, so you know.
Any attributes given as sources for a transformation rule are applied to the target of the transformation rule when the rule is applied.
.DONTCARE | If a target is marked with this attribute and
PMake can not figure out
how to create it, it will ignore this fact and assume
the file is not really needed or actually exists and
PMake just can not find
it. This may prove wrong, but the error will be
noted later on, not when PMake
tries to create the target so marked. This attribute also
prevents PMake from attempting
to touch the target if it is given the
-t flag. |
.EXEC | This attribute causes its shell script to be
executed while having no effect on targets that depend
on it. This makes the target into a sort of subroutine.
An example. Say you have some LISP files that need to
be compiled and loaded into a LISP process. To do this,
you echo LISP commands into a file and execute a LISP
with this file as its input when everything is
done. Say also that you have to load
other files from another system before you can compile
your files and further, that you do not want to go
through the loading and dumping unless one of your
files has changed. Your makefile might look a little
bit like this (remember, this is an educational example,
and do not worry about the system : init a.fasl b.fasl c.fasl for i in $(.ALLSRC); do echo -n '(load "' >> input echo -n ${i} >> input echo '")' >> input done echo '(dump "$(.TARGET)")' >> input lisp < input a.fasl : a.l init COMPILE b.fasl : b.l init COMPILE c.fasl : c.l init COMPILE COMPILE : .USE echo '(compile "$(.ALLSRC)")' >> input init : .EXEC echo '(load-system)' > input
|
.EXPORT | This is used to mark those targets whose creation should be sent to another machine if at all possible. This may be used by some exportation schemes if the exportation is expensive. You should ask your system administrator if it is necessary. |
.EXPORTSAME | Tells the export system that the job should be exported to a machine of the same architecture as the current one. Certain operations (e.g. running text through nroff) can be performed the same on any architecture (CPU and operating system type), while others (e.g. compiling a program with cc) must be performed on a machine with the same architecture. Not all export systems will support this attribute. |
.IGNORE | Giving a target the
.IGNORE attribute causes
PMake to ignore errors
from any of the target's commands, as if they all
had - before them. |
.INVISIBLE | This allows you to specify one target as a source for another without the one affecting the other's local variables. Useful if, say, you have a makefile that creates two programs, one of which is used to create the other, so it must exist before the other is created. You could say prog1 : $(PROG1OBJS) prog2 MAKEINSTALL prog2 : $(PROG2OBJS) .INVISIBLE MAKEINSTALL
where |
.JOIN | This is another way to avoid performing some
operations in parallel while permitting
everything else to be done so. Specifically it forces
the target's shell script to be executed only if
one or more of the sources was out-of-date. In
addition, the target's name, in both its
program : $(OBJS) libraries cc -o $(.TARGET) $(.ALLSRC) libraries : lib1.a lib2.a lib3.a lib4.a .JOIN ranlib $(.OODATE)
In this case, PMake will re-create
the |
.MAKE | The
and have it descend the directory tree (if your
makefiles are set up correctly), printing what
it would have executed if you had not included
the |
.NOEXPORT | If possible,
PMake will attempt to
export the creation of all targets to another machine
(this depends on how PMake
was configured). Sometimes, the creation is so
simple, it is pointless to send it to another machine.
If you give the target the
.NOEXPORT attribute, it will be run
loally, even if you have given
PMake the -L
0 flag. |
.NOTMAIN | Normally, if you do not specify a target to
make in any other way,
PMake will take the first
target on the first dependency line of a makefile as
the target to create. That target is known as the
“Main Target” and is labeled as such if
you print the dependencies out using the
-p flag. Giving a target this
attribute tells PMake that
the target is definitely not the Main Target. This
allows you to place targets in an included makefile
and have PMake create
something else by default. |
.PRECIOUS | When PMake is
interrupted (you type control-C at the keyboard), it will
attempt to clean up after itself by removing any
half-made targets. If a target has the
.PRECIOUS attribute, however,
PMake will leave it alone.
An additional side effect of the ::
operator is to mark the targets as
.PRECIOUS . |
.SILENT | Marking a target with this attribute keeps its
commands from being printed when they are
executed, just as if they had an @
in front of them. |
.USE | By giving a target this attribute, you turn it
into PMake's equivalent of
a macro. When the target is
used as a source for another target, the other target
acquires the commands, sources and attributes (except
lib1.a : $(LIB1OBJS) MAKELIB lib2.a : $(LIB2OBJS) MAKELIB MAKELIB : .USE rm -f $(.TARGET) ar cr $(.TARGET) $(.ALLSRC) ... ranlib $(.TARGET)
Several system makefiles (not to be confused
with The System Makefile) make use of these
|
All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/
Questions that are not answered by the
documentation may be
sent to <[email protected]>.
Send questions about this document to <[email protected]>.