Wednesday, February 02, 2005

Makefile

Here's what your makefile (with dmalloc support) should look like..
DMALLOC = ../dmalloc-5.4.2

CC = gcc
INCLUDE = ./include
SOURCE = ./src
BIN = ./bin
OBJ = ./object
CFLAGS = -g -Wall -Werror -I$(INCLUDE) -I$(DMALLOC) -DDMALLOC

OBJECTS = file1.o file2.o ...

vpath %.h $(INCLUDE)
vpath %.c $(SOURCE)

binary: $(OBJECTS)
$(CC) -o $(BIN)/binary $(OBJECTS) ${DMALLOC}/libdmalloc.a
mv *.o $(OBJ)

$(OBJECTS): common.h

file1.o: file1.h
file2.o : file2.h
main.o : main.h

clean :
rm -f $(BIN)/binary
rm -f $(OBJ)/*.o

0 Comments:

Post a Comment

<< Home