Whats wrong with my makefile

Posted by user577220 on Stack Overflow See other posts from Stack Overflow or by user577220
Published on 2011-01-16T03:14:57Z Indexed on 2011/01/17 23:53 UTC
Read the original article Hit count: 137

Filed under:
|
#####################################################################
# This is the filesystem makefile "make_BuddyAlloc".
# Author:Michael Gomes
# Date:2 jan 2011
######################################################################

#variable defination
CC = gcc
CFLAGS = -g -O2
SRC_DIR=src
INC_DIR=inc
OBJ_DIR=obj

#List of source files 
SOURCE= buddyMain.c \
  Copy.c \


#List of object files 
OBJECTS=$(addprefix $(OBJ_DIR)/,$(SOURCE:.c=.o))

#BuddyAlloc is dependent on "obj/*.o".
BuddyAlloc : $(OBJECTS)
 $(CC) $(CFLAGS) -o BuddyAlloc $<

#obj/*.o depends on src/*.c and inc/*.h, we are redirecting the object files to obj folder
$(OBJECTS):$(SRC_DIR)/$(SOURCE)  
 $(CC) $(CFLAGS) -I$(INC_DIR) -o $(OBJ_DIR)/$(OBJECTS) -c $<


#Cleans all the *.exe files
clean:
 rm -f *.exe

I have kept the source files under src folder includes under inc folder and the object files are being saved in obj folder .given above is the makefile i am trying to create for my mini project. I keep getting the error no rule to make target 'Copy.c' needed by 'obj/buddyAlloc.o', but it works fine it i dont include Copy.c, what did i do wrong?

© Stack Overflow or respective owner

Related posts about makefile

Related posts about gnumake