Skip to contentSkip to conversation

possibly silly question about top-level Makefile

Buildroot Robert P. J. Day 2 participants 2 messages Apr 16, 2015

lore
Share & tools
lore
#0 lore raw

never worried about embarrassing myself, i was perusing the
top-level Makefile to see how some of the targets are processed and noticed the following.

if i start with a fresh checkout, and do:

$ make beaglebone_defconfig

i see the rule that kicks in (well, at least the first one for that pattern):

%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(TOPDIR)/configs/$@ \
                $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)

what i don't understand is the purpose of that "mkdir" command in the rule.

see, the first dependency of that rule is
$(BUILD_DIR)/buildroot-config/conf, and the rule to process that would *seem* to be:

$(BUILD_DIR)/buildroot-config/%onf:

        mkdir -p $(@D)/lxdialog
        PKG_CONFIG_PATH="$(HOST_PKG_CONFIG_PATH)" $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" \
            obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

where you can see that the first command in *that* rule is to create the required directory $(BUILD_DIR)/buildroot-config/, no? so once that dependency has been satisfied, the directory $(BUILD_DIR)/buildroot-config should now exist, right? so i don't see the point of *explicitly* doing a mkdir command in that first rule.

in fact, if you look@the collection of rules:

xconfig: $(BUILD_DIR)/buildroot-config/qconf outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)

gconfig: $(BUILD_DIR)/buildroot-config/gconf outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) srctree=$(TOPDIR) $< $(CONFIG_CONFIG_IN)

menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)

nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)

config: $(BUILD_DIR)/buildroot-config/conf outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)

isn't the "mkdir" command in *all* of those redundant?

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 1 line · Robert P. J. Day

[snip]

Quoted 9 lines

nconfig: $(BUILD_DIR)/buildroot-config/nconf outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)

config: $(BUILD_DIR)/buildroot-config/conf outputmakefile

        @mkdir -p $(BUILD_DIR)/buildroot-config
        @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)

isn't the "mkdir" command in *all* of those redundant?

Good catch!

Patch follows.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F