c - In MAKE file : error showing no such file or directory -
i have simple makefile. when run make
following error:
gcc -i -o server server.o comfunc.o gcc: error: comfunc.o: no such file or directory make: *** [server] error 1
my makefile:
cc=gcc cflags=-i aim = server heads = ../common/common.h objs = comfunc.o mobj = server.o miscs = server.cfg srcs = ${objs:.o=.c} ${mobj:.o=.c} #targets all: $(aim) server:server.o $(cc) $(ldflags) $(cflags) -o server server.o $(objs) $(libs) #dependency $(objs):../common/common.h comfunc.o: ../common/common.h #--end of makefile--
add $(objs) , $(mobj) dependency server make sure implicit makefile rules executed produces corresponding .o
s
refer makefile below
cc=gcc cflags=-i aim = server heads = ../common/common.h objs = comfunc.o mobj = server.o miscs = server.cfg srcs = ${objs:.o=.c} ${mobj:.o=.c} #targets all: $(aim) server:server.o $(objs) $(mobj) $(cc) $(ldflags) $(cflags) -o server server.o $(objs) $(libs) #dependency $(objs):../common/common.h comfunc.o: ../common/common.h