Surprised by change in rules.mk

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
geoffrey.brown
Posts: 122
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 18 times

Surprised by change in rules.mk

Post by geoffrey.brown »

I'm working on porting my projects from 20.3 to 21.11 and found the following surprising change in rules.mk (from ARMCMx/...../GCC)

< IINCDIR := $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
> IINCDIR := $(sort $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR)))

Not sure why a decision was made to sort the user includes, but order matters in complex builds.

Geoffrey
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Surprised by change in rules.mk

Post by Giovanni »

Hi,

It is done to remove duplicate paths, some .mk files add the same paths to shared modules.

This can be a problem only if you have colliding file names in your paths, which should be avoided if possible.

Giovanni
geoffrey.brown
Posts: 122
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 18 times

Re: Surprised by change in rules.mk

Post by geoffrey.brown »

I guess my use situation is unusual. I have a whole collection of related devices (data loggers for songbirds) and I do sometimes need to override include files in my common source code and I have had, on occasion, to tweak include files from the chibios directories. In the short run, I tweaked the the rules file, but I guess in the long run I'll have to track down and eliminate the problem cases.
geoffrey.brown
Posts: 122
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 18 times

Re: Surprised by change in rules.mk

Post by geoffrey.brown »

I've thought about this a bit more, is there a compelling reason to sort UINC with all the other includes. As it stands, there is no way to override an existing include file.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Surprised by change in rules.mk

Post by Giovanni »

Hi,

You could simply bring rules.mk in your project and tweak it, it is just an inclusion in your makefile, not something that can break later anyway.

Giovanni
Post Reply