Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I define #define in my Make files

In my c/c++ files, there are multiple #define. As an example:

#ifdef LIBVNCSERVER_HAVE_LIBZ
  /* some code */
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
  /* some more code */

Can you please tell me how can I modify my Makefile.in so that I have those #define in ALL files during compilation?

Thank you.

like image 844
n179911 Avatar asked Jan 26 '10 00:01

n179911


1 Answers

-DLIBVNCSERVER_HAVE_LIBZ -DLIBVNCSERVER_HAVE_LIBJPEG

You could pass those in CPPFLAGS,

CPPFLAGS = -DLIBVNCSERVER_HAVE_LIBZ -DLIBVNCSERVER_HAVE_LIBJPEG

or make new variable

CUSTOMDEFINES = -DLIBVNCSERVER_HAVE_LIBZ -DLIBVNCSERVER_HAVE_LIBJPEG

and pass it to CPPFLAGS = -DEXISTINGFLAGS $(CUSTOMDEFINES)

Those are finally will pass to gcc/g++ -D...

$(CC) $(CPPFLAGS)
like image 121
YOU Avatar answered Sep 28 '22 08:09

YOU