help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can make generate different file name depend on header file's define


From: Mark Galeck
Subject: Re: can make generate different file name depend on header file's define
Date: Fri, 19 Apr 2013 03:36:13 -0700 (PDT)

Yes but it is not going to be very easy.  

There is a principle of good design in software engineering, that each piece of 
information should be defined in one place only, and then other users of that 
information get it from there.  

You want to define the name of your "out file" in your C code, where your C 
preprocessor can easily see it.  That is the hardest place however, to 
communicate to the other users of that information - the compiler and the GNU 
Make.  That is because the information most easily flows from GNU Make, to the 
compiler, and then to the preprocessor, in  that direction. 

You could define that information instead on the compiler command line 
(better), 
or (best) as a GNU Make variable.

If you insist on doing it "your" way, you will have to make at least a 
primitive 
version of a preprocessor (or add features to an open source preprocessor), 
that 
will parse out your header file features as you show below, figure out what 
name 
you want, and hand it to the compiler, and preferably also to GNU Make.  

Mark



________________________________
From: loody <address@hidden>
To: "address@hidden" <address@hidden>
Sent: Fri, April 19, 2013 1:34:39 AM
Subject: can make generate different file name depend on header file's define

hi all:
There is a header file in my project like below


#define DEBUG_VERSION
//#undef DEBUG_VERSION

//#define RELEASE_VERSION
#undef REAL_CHIP_VERSION

#ifdef DEBUG_VERSION
#define FILE_NAME "DEBUG"
#endif

#ifdef RELEASE_VERSION
#define FILE_NAME "DEBUG"
#endif


is it possible the out file name created by Make will dynamically changed
by above FILE_NAME

-- 
Thanks for your help in advance,
_______________________________________________
Help-make mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-make


reply via email to

[Prev in Thread] Current Thread [Next in Thread]