home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Previous Section Next Section

confDEPEND_TYPE

How to build Makefile dependencies Build macro

The confDEPEND_TYPE macro defines the method that should be included in your Makefile for use in creating make(1) dependencies. The methods supported are located in the devtools/M4/depend directory. We show them in Table 2-6.

Table 2-6. Build m4 directives

Method

File

How invoked

AIX

devtools/M4/depend/AIX.m4

${CC} -M -E ${COPTS} $$i

BSD

devtools/M4/depend/BSD.m4

mkdep -a -f Makefile ${COPTS} *.c

CC-M

devtools/M4/depend/CC-M.m4

${CC} -M ${COPTS} *.c >> Makefile

generic

devtools/M4/depend/generic.m4

nothing

NCR

devtools/M4/depend/NCR.m4

${CC} -w0 -Hmake ${COPTS} *.c >> Makefile

Solaris

devtools/M4/depend/Solaris.m4

${CC} -xM ${COPTS} *.c >> Makefile

X11

devtools/M4/depend/X11.m4

makedepend — ${COPTS} — *.c

Note that the correct Solaris method is usually chosen for you in an appropriate devtools/OS file. But in the rare case that the method is wrong or broken, you can use this confDEPEND_TYPE to select another method. For example, consider this broken implementation of a mkdep script:

mkdep -a -f Makefile -I. -DNEWDB *.c
cc: Warning: Option -f passed to ld
cc: Warning: File with unknown suffix (Makefile) passed to ld

In this example, we know we are running X11, and so we chose to replace the defective mkdep with the makedepend(1) program:

define(`confDEPEND_TYPE', `X11')

The new method is specified as the filename (with the .m4 suffix removed) in the devtools/M4/depend directory. Rerunning the Build with -c and this new definition will produce error-free output:

Making dependencies in obj.SunOS.4.1.3.sun4
makedepend -- -I. -I/usr/local/include/db -DNEWDB -DNEWDB -DMATCHGECOS=0 -- *.c
Making in obj.SunOS.4.1.3.sun4
    Previous Section Next Section