.Dd January 4, 1998 .Dt MAKEFILES 7 .Os .Sh NAME .Nm makefiles .Nd various includable makefiles .Sh DESCRIPTION .Bl -tag -width "xxxx" .It local-prog .Dl .include This is for building/installing a local program. It uses several variables, which should be set before doing the .include: .Bl -tag -width "xxxx" .It Dv CFLAGS_ADD Program-specific things to add to .Dv CFLAGS . .It Dv LOCALROOT The root of the local tree. This defaults to .Pa /local , and normally will not be set in programs' Makefiles, instead coming from the environment or else defaulting to the installed value. .It Dv VERSION The program name and version. This defaults to the last component of .Dv .CURDIR . .It Dv INSTBINDIR The directory to install binaries into. Defaults to .Sm off .Pa Xo .Pf \&$ Po Dv LOCALROOT Pc /.bin/ .Pf \&$ Pq Dv VERSION .Xc . .Sm on .It Dv INSTHDRDIR The directory to install headers into. Defaults to .Sm off .Pa Xo .Pf \&$ Po Dv LOCALROOT Pc /.include/ .Pf \&$ Pq Dv VERSION .Xc . .Sm on .It Dv INSTLIBDIR The directory to install libraries (or data files) into. Defaults to .Sm off .Pa Xo .Pf \&$ Po Dv LOCALROOT Pc /.lib/ .Pf \&$ Pq Dv VERSION .Xc . .Sm on .It Dv INSTMANDIR The directory to install man pages into. Defaults to .Sm off .Pa Xo .Pf \&$ Po Dv LOCALROOT Pc /.man/ .Pf \&$ Pq Dv VERSION .Xc . .Sm on .It Dv BUILDBINS List of executable files to build. For each executable .Em foo , the variable .Dv OBJ_ Ns Em foo is a list of object files from which that executable is to be built, with .Dv LIBS_ Ns Em foo listing libraries. Additionally, .Dv OBJALL lists object files, and .Dv LIBS lists libraries, all programs have in common. .Dv LDFLAGS_ Ns Em foo is a list of flags to pass to the compiler's link step. (The difference between .Dv LIBS_ Ns Em foo and .Dv LDFLAGS_ Ns Em foo is that the latter is named before the .Dv OBJ_ Ns Em foo list, whereas the former is named after it.) If the .Dv OBJ_ Ns Em foo variable is not set, it is set to .Pa foo.o ; for the .Dv LIBS_ Ns Em foo and .Dv LDFLAGS_ Ns Em foo variables, the default is the empty string. For cases where ordering between .Dv LIBS_ Ns Em foo and .Dv LIBS matters, and the default order .Po .Pf \&$ Pq Dv LIBS_ Ns Em foo .Pf \&$ Pq LIBS .Pc is not correct, if .Dv OVERRIDE_LIBS_ Ns Em foo is defined, it will be used .Em instead of any values .Dv LIBS_ Ns Em foo and .Dv LIBS might have. If no .Dv \&.MAIN target is defined, one will be supplied, listing the files in .Pf \&$ Pq Dv BUILDBINS . .It Dv CLEANFILES Files to remove on .Sq make clean . Executables in .Pf \&$ Pq Dv BUILDBINS , and the object files for them, are automatically included in .Dv CLEANFILES . .It Dv INSTALLBIN Files to install into .Dv INSTBINDIR . .Xr install 1 with .Fl c is used to perform the installation. If .Dv BUILDBINS is set and non-empty, but .Dv INSTALLBIN is not set at all, then the latter defaults to the former. .It Dv INSTALLHDR Files to install into .Dv INSTHDRDIR . .Xr cp 1 is used to perform the installation. .It Dv INSTALLLIB Files to install into .Dv INSTLIBDIR . .Xr cp 1 is used to perform the installation. .It Dv INSTALLMAN Files to install into .Dv INSTMANDIR . .Xr cp 1 is used to perform the installation. The names in this list should be the conventional nroff-source names, as in .Pa foo.1 , not .Pa foo.cat1 or .Pa foo.0 . The .Pa .cat Em x file will be built and installed as a .Pa .0 file. (If a target for the .Pa .cat Em x file is already defined, it will suppress the provided one.) .It Dv PREDEPEND A list of files that must be built before running .Xr mkdep 1 for .Sq make depend . .El .Pp In addition, there are a few variables that are used for internal purposes; their previous values, if any, are ignored and destroyed. They are .Dv INSTLINKSTMP1 , .Dv INSTLINKSTMP2 , .Dv REMOVEDIRS , and .Dv CLEANFILES_ . .Pp This makefile defines several targets. It defines one for each word in .Dv BUILDBINS , one for the installed version of each file to install, one for each directory to install into that doesn't yet exist, and a rule for .Sq depend . It also defines a .Sq predepend target, which builds all the .Dv PREDEPEND targets but does not actually build dependencies. In addition, it will define rules for some targets only if they haven't yet been defined, notably .Sq \&.MAIN and for .Pa .cat Ns Em x files, as noted above. Some targets are also defined as .Em \&:: targets (see .Xr make 1 ) . These are .Sq install_dirs , .Sq install_files , .Sq install , .Sq remove , and .Sq clean . .El .Sh AUTHOR der Mouse, .Aq mouse@rodents.montreal.qc.ca .