Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Dec 2009 08:17:52 +0100
From:      Oliver Mahmoudi <olivermahmoudi@gmail.com>
To:        "freebsd-questions@FreeBSD.org" <freebsd-questions@freebsd.org>
Subject:   how does the C pre-processor interface with make?
Message-ID:  <6b4b2d2c0912292317h7c4d9bbfo196dcf48396e0afa@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hey folks,

I was wondering how the C pre-processor interfaces with make. Let's suppose
that I have a little C program, something along the lines of:

#include <stdio.h>

int
main()
{
#ifdef FOO
     fprintf(stdout, "Hi, my name is foo.\n");
#endif

#ifdef BAR
     fprintf(stdout, "Hi, my name is bar.\n");
#endif

     fprintf(stdout, "I am always here.\n");

     return(1-1);
}

It is easy to control the pre-processor in the above code by defining the
respective terms or leaving them out, however,
I am trying to control the conditionals from out of a makefile.

This is essentially the way in which the kernel sources are compiled.

Any suggestions?

Thanks

Oliver



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6b4b2d2c0912292317h7c4d9bbfo196dcf48396e0afa>