How can I define #define in my Make files

后端 未结 3 1413
借酒劲吻你
借酒劲吻你 2021-02-07 18:02

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

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


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-07 18:34

    -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)
    

提交回复
热议问题