Skip to content

tool/create_builddir: make sure GENODE_DIR always points to the right directory #5724

@sidhussmann

Description

@sidhussmann

Following up from #5593 (comment): To make sure I verify an observation with a fresh genode repository that doesn't contain any build artifacts from previous builds, I used the following steps:

$ cd /home/user/misc-code
$ git clone git@github.com:genodelabs/genode.git
$ cd genode
$ git checkout staging
$ tool/create_builddir x86_64 build/x86_64-staging

Unfortunately, I had the environment variable GENODE_DIR set to /home/user/code/genode which hosts our genode fork (notice code vs misc-code. This meant that the build/x86_64-staging/Makefile was pointing to the other genode directory:

$ pwd
/home/user/misc-code/genode
$ ls -hal build/x86_64-staging
total 12K
drwxrwxr-x 3 user user 4.0K Oct 23 13:37 .
drwxrwxr-x 3 user user 4.0K Oct 23 13:37 ..
drwxrwxr-x 2 user user 4.0K Oct 23 13:37 etc
lrwxrwxrwx 1 user user   45 Oct 23 13:37 Makefile -> /home/user/code/genode/tool/builddir/build.mk

While create_builddir did produce some warnings, everything seemed good enough.

When executing a run-script using make -C build/x86_64-staging/ KERNEL=hw BOARD=pc run/depot_download it ended up building from our genode fork instead of the current genode (staging) directory.

This led me wondering, would it make sense to set GENODE_DIR unconditionally in tool/create_builddir?

diff --git a/tool/create_builddir b/tool/create_builddir
index d78c9c0375..ce646864b8 100755
--- a/tool/create_builddir
+++ b/tool/create_builddir
@@ -34,7 +34,7 @@ usage:
 # Determine Genode base directory based on the known location of the
 # 'create_builddir' tool within the Genode source tree
 #
-GENODE_DIR ?= $(realpath $(dir $(MAKEFILE_LIST))/..)
+GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/..)
 
 #
 # Define default location of the build directory if not explicitly specified

In any case, please consider this as a minor nitpick and feel free to close this issue without comment if it breaks a use case that I'm unaware of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions