Makefile rule to create DEPDIR Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Post Reply
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Makefile rule to create DEPDIR

Post by faisal »

This seems to be a missing feature in rules.mk . All the more important with multi-demos.

Code: Select all

$(OBJS): | $(BUILDDIR) $(OBJDIR) $(LSTDIR) $(DEPDIR)

$(BUILDDIR):
ifneq ($(USE_VERBOSE_COMPILE),yes)
   @echo Compiler Options
   @echo $(CC) -c $(CFLAGS) -I. $(IINCDIR) main.c -o main.o
   @echo
endif
   @mkdir -p $(BUILDDIR)

$(OBJDIR):
   @mkdir -p $(OBJDIR)

$(LSTDIR):
   @mkdir -p $(LSTDIR)
   
[b]$(DEPDIR):
   @mkdir -p $(DEPDIR)[/b]
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Makefile rule to create DEPDIR

Post by Giovanni »

Hi,

Isn't this done at the end of the rules.mk file?

Code: Select all

#
# Include the dependency files, should be the last of the makefile
#
-include $(shell mkdir -p $(DEPDIR) 2>/dev/null)


Is there a case where this does not work?

Giovanni
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: Makefile rule to create DEPDIR

Post by faisal »

I have a project which needs to support multiple boards. So I tried following the pattern of the 'multi' projects in testhal. I wanted to create a single .dep directory for dependencies, and then sub directories in there for the various boards. So, in the makefile for each board, I have the following variables defined:

CONFDIR := ./cfg/$(BOARD_NAME)
BUILDDIR := ./build/$(BOARD_NAME)
DEPDIR := ./.dep/$(BOARD_NAME)

I got the following error if I didn't modify rules.mk as above.

Compiling crt0_v7m.S
../../../../ChibiOS_18.2.0/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S:1:0: fatal error: opening dependency file ./.dep/stm32l496-snapdragon/crt0_v7m.o.d: No such file or directory

I got not such error with CONFDIR, or BUILDDIR.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Makefile rule to create DEPDIR

Post by Giovanni »

Hi,

I applied the change among other things, please check it is OK for you.

Giovanni
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: Makefile rule to create DEPDIR

Post by faisal »

I don't see the change in 18.2.x stable. The changes you made in trunk look like what I need. Thanks for that! Any plans to update 18.2 stable?
faisal
Posts: 382
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 45 times
Been thanked: 62 times

Re: Makefile rule to create DEPDIR

Post by faisal »

Saw it backported to 18.2 stable. Thanks Giovanni.
Post Reply