[chbot] Is there a GNU makefile guru out there?

Robin Gilks robin at gilks.org
Mon Aug 3 09:02:05 BST 2020


Looking more closely at the error I see I've missed something in my
original description which probably explains the problem (as well as
sending the email without finishing it!!)

repo
  |
  +------- common
              |
              +------- src
                        |
                        +  commonA.c
                        +  commonB.c
                        +  fileD.c
                        + ....
  +------- projectA
              |
              +------- src
                        |
                        +  fileA.c
                        +  fileB.c
                        +  uniqueC.c
                        + ....
  +------- projectB
              |
              +------- src
                        |
                        +  fileC.c
                        +  fileD.c
                        +  uniqueD.c
                        + ....


The error actually occurs on compiling project B when
../common/src/fileD.c is compiled instead of src/fileD.c. I assume this is
due to the vpath using a sorted list of directories and common/src comes
before src.

The reason I'm using vpath is because the template used by stm32CubeMX to
generate makefiles uses it. Until yesterday I had no idea it might cause
problems.

I don't seems to be able to get 'make' to compile all the files from the
C_SOURCES variable without using vpath - basically because I don't really
know how 'make' works!



-- 
Robin Gilks





More information about the Chchrobotics mailing list