tell make file not to compile debug code
Hi all
I've been trying to work out a way to stop chunks of code being compiled using a variable in my makefile but can't work it out. What I mean is for example in my code I might have. /****output comms portdata********/ printf("\n debug comms port %d",ReadPort("ttys1); I only wish this code to be compiled when I'm debugging. What I've tried is using #ifdef with #ifdef COMM_PORT_DEBUG printf("\n debug comms port %d",ReadPort("ttys1); #endif Then in my make file I set COMM_PORT_DEBUG to 1 so DEBUG_DEFS = COMM_PORT_DEBUG=1 I then thought I could put it into my in my link line all: $(CC) $(CPFLAGS) $(DEBUG_DEFS) $(INC_PATHS) $(SOURCE) -o $(PROGRAM) $(LIB_DIRS) $(GAME_LIBS) but this gives a gcc: COMM_PORT_DEBUG=1: No such file or directory is there a way to do this sort of thing? Or am I barking up the wrong tree? Thanks! |
are you missing the -D switch?
|
All times are GMT -5. The time now is 08:54 PM. |