Hi Guys, I'm new to the world of Makefile writing. I have a C project which I want to build using GCC and I could write fairly a very good Makefile, which calls 3 other Makefiles, present in different directory structure of the project, recursively, who will then send the respective source files to the GCC compiler. The result of this step is that I'm able to see all the (5) object files of (5) source files.
Object file names (In the order of their generation)-
Makefile1
imageprocessing.o (1)
morpho.o (2)
PivBlb.o (3)
Makefile2
main.o (4)
Makefile3
bmp.o (5)
Under the confidence of seeing all the expected object files. I now add additional rules in the Makefile3, to link all the object files, here the linker will start giving the errors section as shown below.
Not just that, the last object file (bmp.o (5)) which was getting generated before is NOT getting generated anymore, my new updates to the last makefile have caused this I guess.
Whats happening here? Any hints, please?
I'm also pasting only the contents of the last Makefile - Makefile3, where Linking rules are present, below the Errors section.
Thank you
-V
-------------------------------------
**Errors**
make[1]: Entering directory `/cygdrive/c/Vikram/Projects/LOD_IMX_Project_v1/LOD1/Algorithm'
make[1]: `all' is up to date.
make[1]: Leaving directory `/cygdrive/c/Vikram/Projects/LOD_IMX_Project_v1/LOD1/Algorithm'
make[1]: Entering directory `/cygdrive/c/Vikram/Projects/LOD_IMX_Project_v1/LOD1/exe'
make[1]: `all' is up to date.
make[1]: Leaving directory `/cygdrive/c/Vikram/Projects/LOD_IMX_Project_v1/LOD1/exe'
make[1]: Entering directory `/cygdrive/c/Vikram/Projects/LOD_IMX_Project_v1/LOD1/IO'
make[1]: Leaving directory `/cygdrive/c/Vikram/Projects/LOD_IMX_Project_v1/LOD1/IO'
make[1]: *** No rule to make target `../LOD1/Algorithm/imageprocessing.o', needed by `final'. Stop.
make: *[all] Error 2
----------------------------------------
Makefile3
CC = $(TOOLS)/gcc
HFLAG = ../IO/inc
CCFLAGS = -mcpu=$(HW)
OBJ1 = ../LOD1/Algorithm/imageprocessing.o ../LOD1/Algorithm/morpho.o ../LOD1/Algorithm/PivBlb.o
OBJ2 = ../LOD1/exe/main.o
OBJ3 = ../LOD1/IO/bmp.o
all: final
final: ../LOD1/Algorithm/imageprocessing.o ../LOD1/Algorithm/morpho.o ../LOD1/Algorithm/PivBlb.o ../LOD1/exe/main.o ../LOD1/IO/bmp.o
$(CC) -o $@ $(OBJ1) $(OBJ2) $(OBJ3)
bmp.o: src/bmp.c inc/bmp.h
$(CC) $(CCFLAGS) -I$(HFLAG) -c src/bmp.c
clean:
rm -rf *o main.o