View Single Post
Re: GNU Make question
Old
  (#2)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: GNU Make question - 02-07-2005

Are you using the right macro?
Because this works for me...

dtest.c
Code:
#include <stdio.h>

int main( void ) {
	#ifdef _SERVER_
	printf( "Server started!\n" );
	#else
	printf( "Client started!\n" );
	#endif

	return 0;
}
Makefile
Code:
CC=gcc
CFLAGS=-O2
CLFILE=client.exe
SVFILE=server.exe

server:
	$(CC) $(CFLAGS) -o $(SVFILE) -D_SERVER_ dtest.c

client:
	$(CC) $(CFLAGS) -o $(CLFILE) dtest.c

clean:
	rm client.exe
	rm server.exe
	rm dtest.o
  
Reply With Quote