Page 1 of 1
Makefile rule to create DEPDIR
Posted: Sat Mar 17, 2018 4:40 am
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]
Re: Makefile rule to create DEPDIR
Posted: Sat Mar 17, 2018 9:13 am
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
Re: Makefile rule to create DEPDIR
Posted: Sun Mar 18, 2018 2:07 am
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.
Re: Makefile rule to create DEPDIR
Posted: Fri Mar 23, 2018 12:00 pm
by Giovanni
Hi,
I applied the change among other things, please check it is OK for you.
Giovanni
Re: Makefile rule to create DEPDIR
Posted: Tue Mar 27, 2018 9:30 pm
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?
Re: Makefile rule to create DEPDIR
Posted: Thu Apr 05, 2018 5:34 am
by faisal
Saw it backported to 18.2 stable. Thanks Giovanni.