Ethereal-dev: Re: [Ethereal-dev] Conversion of @foo@ macros in config.h.win32

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Guy Harris" <gharris@xxxxxxxxx>
Date: Thu, 11 Nov 2004 17:29:32 -0800 (PST)
Bryan Miller said:
> I notice that the macros in config.h.win32 such as
>
> @HAVE_LIBPCAP@
>
> are converted to
>
> ^#DEFINE HAVE_LIBPCAP 1
>
> in the generation of config.h.  What is the rationale in using the ^#
> (literal #) for these defines when the other defines in config.h are
> simply #DEFINE?

To quote the comment in config.nmake:

    # Nmake uses carets to escape special characters

and to quote the nmake documentation at

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcug98/html/_asug_special_characters_in_macros.asp

"A number sign (#) after a definition specifies a comment. To specify a
literal number sign in a macro, use a caret (^), as in ^#."

> My reason for asking is that this construct blows up a couple of
> different Windows make tools including Opus make (omake)

Then perhaps Opus make isn't compatible with nmake - in which case it
shouldn't be used with Makefile.nmake, as Makefile.nmake is written for
use with nmake and expects nmake semantics.

> and some versions of nmake.

Then perhaps those versions of nmake break compatibility - in which case
they shouldn't be used with Makefile.nmake.

> Two questions:
>
> 1) Is is necessary?

Yes - if I remember correctly, the desired output isn't produced in
config.h if you don't quote the "#".

> 2) Where does the translation from "@foo@" to "^#DEFINE foo 1" occur?

The translation from @FOO@ to $(BAR) occurs in the "config.h" rule in
Makefile.nmake.

The definition of BAR occurs in config.nmake.