Problem with Makefile

Hi,

Here is my makefile http://pastie.org/1104332. I am trying to compile different .c files and .s files (assembly files) from different sub directories into E:/em35x/build/mfg-sample-app-cortexm3-iar-em357-em3xx-dev0680/ then the linker should link all the .o files from the build directory (E:/em35x/build/mfg-sample-app-cortexm3-iar-em357-em3xx-dev0680) into a file named mfg-sample-app.out.
When I run the makefile which I posted above then the compiler compiles all the source files into object files in the build directory but the linker can not open the object files because its not looking for them in the build directory which is E:/em35x/build/mfg-sample-app-cortexm3-iar-em357-em3xx-dev0680. I dont know how why the linker does not look there? that is the error I get
#1104348 - Pastie (first it compiles the source files but at the end it cannot find the object files in the build folder)

Now after I delete line 70 from the makefile which is
OBJ = $(SRC:.c=.o) E:/em35x/hal/micro/cortexm3/faults.o E:/em35x/hal/micro/cortexm3/isr-stubs.o

then the linker can find the previous compiled object files in the build directory and creates the .out file. And if I manually delete all the object files from the build directory (which the compiler created previously) and run the makefile again (line 70 is still deleted) then I get this error:

1
2
3
$ make
make: *** No rule to make target `E:/em35x/build/mfg-sample-app-cortexm3-iar-em3
57-em3xx-dev0680/mfg-sample.o', needed by `mfg-sample-app.out'. Stop.

And if I add line 70 again which is :
OBJ = $(SRC:.c=.o) E:/em35x/hal/micro/cortexm3/faults.o E:/em35x/hal/micro/cortexm3/isr-stubs.o
then it compiles again but does not link because it cannot open the object files. (The first mentioned error again)

I dont know what I am doing wrong. I have tried many things but cannot find my problem.

Thanks

Not sure if this is your problem but it's a problem I have found in the past. The compiler will by default, put the object file in the current working directory, not necessarily the same directory as the .c file. so

cd to directory mydir that has a sub dir src with source file file1.c.

compile src/file1.c from mydir will result in object file mkdir/file1.o, not mydir/src/file1.o

hope this helps