make: *** No rule to make target

Please tell me what I am missed in this Makefile:
1
2
3
4
5
6
LIB =../../../../../../Arduino/libraries/lib_folder
CPPFLAGS += -Wall
INCLUDES  = -I$(LIB)

a: main.cpp CustomClass.h LibClass.h
	$(CXX) $(CFLAGS) $(INCLUDES) $^ -o $@


I checked the path and file name.
Copy and paste path to cmd window, cd confirms the path and ls confirms the file name:
C:\Users\wolf\Documents\developer\uC\teensy\demo_ino\libClass_depend_on_sketchClass\sketch_folder1>cd ../../../../../../Arduino/libraries/lib_folder
C:\Users\wolf\Documents\Arduino\libraries\lib_folder>ls
LibClass.h  LibClass.h~

Return to the Makefile
C:\Users\wolf\Documents\Arduino\libraries\lib_folder>cd ..\..\..\developer\uC\teensy\demo_ino\libClass_depend_on_sketchClass\sketch_folder1

C:\Users\wolf\Documents\developer\uC\teensy\demo_ino\libClass_depend_on_sketchClass\sketch_folder1>ls
CustomClass.h   Makefile   main.cpp   main1.ino~
CustomClass.h~  Makefile~  main1.ino

But Make is not finding the LibClass.h file:
C:\Users\wolf\Documents\developer\uC\teensy\demo_ino\libClass_depend_on_sketchClass\sketch_folder1>make
make: *** No rule to make target `LibClass.h', needed by `a'.  Stop.

I removed the macros from the Makefile and still get the same error:
1
2
a: main.cpp CustomClass.h LibClass.h
	$(CXX) $(CPPFLAGS) -I../../../../../../Arduino/libraries/lib_folder $^ -o $@

This should be simple, but I am not seeing the cause of the error.
Than you for taking a look.
Last edited on
Not sure how common it is to use the files of other libraries as make dependencies...

If you just remove LibClass.h from line 5 it should work (unless you make changes to LibClass.h).

If you really want LibClass.h as a dependency you will have to give the full path.
 
a: main.cpp CustomClass.h ${LIB}/LibClass.h
Last edited on
Thank you Peter87! That fixed it.
Topic archived. No new replies allowed.