Makefiles improvements

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Makefiles improvements

Post by barthess »

Hi, Giovanni.
I have some idea about make system improvements.
It will be convenient to has "MAKE_ALL_RULE_HOOK" in rules.mk for simplification of adding user rules to Makefile.

For example I want to see how much rom and ram will use my program in MCU. Yes, I can investigate my ch.map and check size of ch.bin. But it will be better to get this info in console just after building. I write simple script and add

Code: Select all

MAKE_ALL_RULE_HOOK: ram

ram: $(PROJECT).map
   ./ram_usage.sh

strings to my project Makefile.

I can realize this feature and contribute patch if need.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Makefiles improvements

Post by Giovanni »

OK, submit the patch, it does not look it can impact anything.

Giovanni
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Makefiles improvements

Post by barthess »

patch here
Attachments
make_system.zip
(863 Bytes) Downloaded 630 times
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Makefiles improvements

Post by Giovanni »

I just updated the rules.mk files, there are way too many Makefile files to update.

Giovanni
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: Makefiles improvements

Post by mabl »

barthess, Just curious, how does your ram check script look like?
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: Makefiles improvements

Post by barthess »

It is quick and dirty shell script.
Attachments
res_usage.zip
(562 Bytes) Downloaded 627 times
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: Makefiles improvements

Post by mabl »

Nontheless some great ideas, thank you barthess
marvin2k
Posts: 4
Joined: Tue Apr 14, 2015 2:16 pm

Re: Makefiles improvements

Post by marvin2k »

Hi,

I need to create some extra targets (headers+libraries) prior to actually compiling the ChibiOS-based code. One hack I found to work is based on adding a `PRE_MAKE_ALL_RULE_HOOK`, similar to the (then renamed) `POST_MAKE_ALL_RULE_HOOK`.

Thoughts? Other ideas to achieve this? Any chances in getting something like the attached patch merged?

Edit: I created a ticket on source-forge. Sorry for the noise...

---

Attaching patch-files directly is not allowed, but adding them zipped is?
Attachments
archive.zip
(960 Bytes) Downloaded 527 times
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Makefiles improvements

Post by Giovanni »

I saw the tickets, thanks, I can forget things posted on the forum but not tickets.

Giovanni
LHelge
Posts: 15
Joined: Sun Sep 21, 2014 10:58 pm
Been thanked: 1 time

Re: Makefiles improvements

Post by LHelge »

Any example of how this is used? My makefile-fu is a little low at this time.

I want to run a python-script to generate some *.c and *.h files before compilation and the PRE_MAKE_ALL_RULE_HOOK seems lite the way to accomplish that without hacking anything other than the project makefile.
Post Reply