From 521fc081802282bac261c3639e9c77fe131f1d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Sun, 31 Oct 2021 06:01:30 +0100 Subject: [PATCH] lib9: pass $PLAN9_TARGET via CPP for get9root fallback value Allows this function to always return the proper path in situations where the $PLAN9 environment variable is not set, i.e. a rc login shell. --- src/lib9/get9root.c | 3 +-- src/lib9/mkfile | 3 +++ src/mkmk.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib9/get9root.c b/src/lib9/get9root.c index 07e2872c..3e7b1050 100644 --- a/src/lib9/get9root.c +++ b/src/lib9/get9root.c @@ -11,7 +11,6 @@ get9root(void) if((s = getenv("PLAN9")) != 0) return s; - /* could do better - search $PATH */ - s = "/usr/local/plan9"; + s = PLAN9_TARGET; return s; } diff --git a/src/lib9/mkfile b/src/lib9/mkfile index db267dfe..ed4315ff 100644 --- a/src/lib9/mkfile +++ b/src/lib9/mkfile @@ -175,6 +175,9 @@ HFILES=\ %.$O: utf/%.c $CC $CFLAGS utf/$stem.c +get9root.$O: get9root.c + $CC $CFLAGS -DPLAN9_TARGET=\"$PLAN9_TARGET\" get9root.c + XLIB=$PLAN9/lib/$LIB testfmt: testfmt.$O $XLIB diff --git a/src/mkmk.sh b/src/mkmk.sh index dfccd369..89718648 100644 --- a/src/mkmk.sh +++ b/src/mkmk.sh @@ -36,7 +36,7 @@ echo cd `pwd` 9c exitcode.c 9c fcallfmt.c 9c frand.c -9c get9root.c +9c -DPLAN9_TARGET=\"$PLAN9_TARGET\" get9root.c 9c getcallerpc.c 9c getenv.c 9c getfields.c