Unix Programming - Query: How can I set precompiler macro values from the 'make' command line?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > November 2004 > Query: How can I set precompiler macro values from the 'make' command line?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Query: How can I set precompiler macro values from the 'make' command line?
Tropos

2004-11-29, 5:55 pm

I have a _TEST_ flag that I want to sometimes set for compilation,
e.g.

#if _TEST_
#include "MyTestInterface.h"
#else
#include "MyRealInterface.h"
#endif

But I am in a version-controlled environment where there is a time
penalty for checking out/checking in the source file or makefile. So I don't
want to use

#define _TEST_

in my code, because then I have to edit the code to do a non-test build.

Is there any way I can say something on the command line like

make -D_TEST_=1

to set the value of _TEST_ for a single build?

(My environment is SunOS, using the native Sun compiler and make.)

Thanks

tropostropos@deletethispart.yahoo.co.uk
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com