Establish files before compiling Build macro

The confBEFORE macro is used to specify the presence of a special header file before compiling. The confBEFORE macro causes an appropriate BEFORE= directive to appear in your Makefile. It is very unlikely that you will ever have to change this from the value that is predefined for you. But if you do, you can do so like this illustration from SunOS 4.0:

define(`confBEFORE', `stdlib.h stddef.h limits.h')
stddef.h stdlib.h limits.h:
        cp /dev/null $@

First, note that the declaration of confBEFORE requires a corresponding section of Makefile code to be inserted between diversions (PUSHDIVERT and POPDIVERT). The first line in this example says that the three files stdlib.h, stddef.h, and limits.h must exist in the obj... directory before sendmail can be compiled. It causes those three header files to be listed with the BEFORE= directive in the resulting Makefile:

BEFORE= stdlib.h stddef.h limits.h
sendmail: ${BEFORE} ${OBJS}

The diversion level 3 (in PUSHDIVERT) causes the two lines that follow to be inserted into the Makefile at the appropriate point. The diversion ends with POPDIVERT.

To illustrate further, suppose you want to include your own C-language source and header files with the Build of sendmail. One way to do this might be to add the following lines to your m4 build file:

APPENDDEF(`conf_sendmail_ENVDEF', `-DMYCODE') APPENDDEF(`confBEFORE', `mycode.h') APPENDDEF(`confSMOBJADD', `mycode.o') PUSHDIVERT(3) ...

Get sendmail, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.