CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Threaded View

  1. #1
    Join Date
    Dec 2008
    Posts
    54

    common #define through all header files and libraries

    Sorry for stupid question, I am a newbie in makefiles and libraries. I have a bunch of implementation *.cc files in source folder and a bunch of header files *.h and libraries *.templates.h in include folder. In the makefile I have
    Code:
    cc-files    = $(shell echo source/*.cc)
    o-files     = $(cc-files:source/%.cc=lib/$(prm)d/%.$(OBJEXT))
    go-files    = $(cc-files:source/%.cc=lib/$(prm)d/%.g.$(OBJEXT))
    h-files     = $(wildcard include/*.h)
    
    # While the ChangeMe is remade every time it is missing...
    ChangeMe: include/DoNotChangeMe.default
    	cp include/DoNotChangeMe.default ChangeMe
    
    Makefile: ChangeMe
    	touch Makefile
    I have global options A and B which influence all code files above. If I would have one file I would use
    Code:
    #define OPTION A
    #if OPTION == A
    ...
    #endif
    #if OPTION == B
    ...
    #endif
    to choose what code I want. Here in ChangeMe I also can define OPTION =1 or OPTION=2 and then use if(OPTION==1) {...} in the code. But is it possible to go through #define which would exclude compilation of unnecessary code?
    Best,
    Serg
    Last edited by StudentFS; March 23rd, 2009 at 11:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured