I had a bunch of src files ( all in one folder) and .h files spread over different folders. With a makefile i was able to build the .c files successfully.
Now, i introduced 2 .c files , but in a different folder to the makefile and am not able to make a successful build. I went through online and came to know that i need to use vpath for this. But even after using vpath, i get errors in the building of the .c file in the new folder.
1) In the below make file, the new .c files added later were fbpath.c and stream.c. 2) I also include the relative path for the include files that these .c files reference. 3) Then i added VPATH, to point to the place where .c files are present.
The error i get is
fbpath.c:30:24: fatal error: config.h: No such file or directory compilation terminated.
but the config.h file is very much present in the INC. I also provided the full path.
Can someone please point me to any mistakes i have done.
Thanks
here is my make file
CC=arm-linux-gnueabihf-gcc
CFLAGS= -c -Wall -std=c99 -fmessage-length=0 -O0
INC = -I. -I../inc -I../APP/inc -I../../../common -I/home/user/workdir/Final/test -I/home/user/workdir/Final/inc -I../../inc
LDFLAGS=-lm
VPATH:=../APP/src
OBJ = main.o correct.o alignment.o fastmath.o cov_est.o subsample.o state.o cconv.o fbpath.o stream.o
myprogram: $(OBJ)
$(CC) $(LDFLAGS) -o myprogram $(OBJ)
correct.o : correct.c
$(CC) $(CFLAGS) $(INC) correct.c
alignment.o : alignment.c
$(CC) $(CFLAGS) $(INC) alignment.c
fastmath.o : fastmath.c
$(CC) $(CFLAGS) $(INC) fastmath.c
cov_est.o : cov_est.c
$(CC) $(CFLAGS) $(INC) cov_est.c
subsample.o : subsample.c
$(CC) $(CFLAGS) $(INC) subsample.c
state.o : state.c
$(CC) $(CFLAGS) $(INC) state.c
cconv.o : cconv.c
$(CC) $(CFLAGS) $(INC) cconv.c
fbpath.o :fbpath.c
$(CC) $(CFLAGS) $(INC) fbpath.c
stream.o : stream.c
$(CC) $(CFLAGS) $(INC) stream.c
main.o : main.c
$(CC) $(CFLAGS) $(INC) main.c
clean:
rm -rf *o myprogram