delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/09/08:41:41

Date: Wed, 9 Dec 1998 07:41:20 -0600
From: jeffw AT darwin DOT sfbr DOT org (Jeff Williams)
Message-Id: <199812091341.HAA06690@kendall.>
To: djgpp AT delorie DOT com
Cc: jeffw AT darwin DOT sfbr DOT org
Subject: Re: Environment variables with BASH
Reply-To: djgpp AT delorie DOT com

Eli, Thank you for your detailed response to my question about environment
variables in bash.  I made some changes to my autoexec.bat and _bashrc files
based on your suggestions.

There is one problem, however, that I can't seem to fix by fiddling with the
bash environment variables: a colon-delimited directory list in makefiles
(e.g., in a vpath statement) will not be recognized, even if PATH_SEPARATOR=:
For some reason I must use semicolons (or spaces).

Is it possible to use colon-delimited directory lists in makefiles (vpath
and elsewhere) under bash simply by setting the environment variables
appropriately, or will I need in this case to resort to the OS-dependent
separator as you described?

TIA,
jeff williams


[setup information follows]

djgpp v2.01
bash 1.14.7 on top of DOS 5.0 COMMAND.COM
make 3.77
gcc 2.7.2.1

following variables set in _bashrc:

SYSROOT=c:
HOME=c:\
PATH_EXPAND=y
PATH_SEPARATOR=:
PATH_SLASH=/
TMPDIR=d:/

Here is the relevant portion of a sample Makefile:

SHELL = /bin/sh
MAKESHELL = /bin/sh
vpath %.c $(HOME)/c/nifl/src:$(HOME)/c/nr/src
# Note colon-delimited directories in above vpath
INCLUDE = -I$(HOME)/c/nifl/include -I$(HOME)/c/nr/include

EXT=.exe
LIBS = -lm
CC = gcc
CFLAGS = -O2 -s -Wall -ansi -DNRANSI -m386 $(INCLUDE)

vcpow:		vcpow.o trabac.o foo.o bar.o
		$(CC) $(CFLAGS) $(LDFLAGS) -o $@$(EXT) $^ $(LIBS)

The `vpath' statement can be exercised by deleting one of the object
files (whose source is not in the current directory) and issuing `make'.
When `make' tries to rebuild the object file, it *will* find the source
if the vpath directory list is `;' (or space) delimited, but it will
*not* find the source if the directory list is `:' delimited.

Output from `make' with semicolon (or space) delimited vpath, after deleting
`foo.o' from the current directory (foo.c resides in $HOME/c/nifl/src):

% make vcpow
gcc -O2 -s -Wall -ansi -DNRANSI -m386 -Ic:\/c/nifl/include -Ic:\/c/nr/include   -c c:\/c/nifl/src/foo.c -o foo.o
gcc -O2 -s -Wall -ansi -DNRANSI -m386 -Ic:\/c/nifl/include -Ic:\/c/nr/include  -o vcpow.exe vcpow.o trabac.o foo.o bar.o -lm

Output from `make' with colon delimited vpath statement:

% make vcpow
make.exe: *** No rule to make target `foo.o', needed by `vcpow'.  Stop.

Output from env:

% env
DIRCMD=/l/p/o:gne
PCPLUS=c:\pcplus\
HOSTNAME=ebola
PATH_SEPARATOR=:
TEMP=c:\djgpp\tmp
TMP=c:\djgpp\tmp
PATH_SLASH=/
SYSROOT=c:
DJGPP=c:/djgpp/djgpp.env
PROMPT=$L$p$G$_š™˜—
TERM=nnansi
HOSTTYPE=PCAT
PATH=.;C:\DJGPP\BIN;C:\UTILITY;C:\ELVIS18;C:\WP51;C:\PE;C:\DOS;C:\NORTON;C:\PARADOX;C:\MINITAB;C:\NCSS;C:\INFOZIP;C:\UTILS
HOME=c:\
SHELL=c:\dos\command.com
USER=jeffw
DJDIR=c:/djgpp
PATH_EXPAND=y
TMPDIR=d:/
EMU387=c:/djgpp/bin/emu387.dxe
LESS=-cS
LFN=n
OSTYPE=MSDOS
COMSPEC=c:\dos\command.com
SHLVL=1
EDITOR=vi
_=c:/djgpp/bin/env.exe

Output from set:

% set
BASH=c:/djgpp/bin/bash.exe
BASH_VERSION=1.14.7(1)
COMSPEC=c:\dos\command.com
DIRCMD=/l/p/o:gne
DJDIR=c:/djgpp
DJGPP=c:/djgpp/djgpp.env
EDITOR=vi
EMU387=c:/djgpp/bin/emu387.dxe
EUID=42
FD=//a
HISTCONTROL=ignoredups
HISTFILE=//_history
HISTFILESIZE=200
HISTSIZE=200
HOME=/
HOSTNAME=ebola
HOSTTYPE=PCAT
IFS= 	

LESS=-cS
LFN=n
MAILCHECK=60
MANPATH=/elvis/doc
OLDPWD=/
OPTERR=1
OPTIND=1
OSTYPE=MSDOS
PATH=.:/djgpp/bin:/utility:/elvis18:/wp51:/pe:/dos:/norton:/paradox:/minitab:/ncss:/infozip:/utils
PATH_EXPAND=y
PATH_SEPARATOR=:
PATH_SLASH=/
PCPLUS=c:\pcplus\
PPID=1
PROMPT=$L$p$G$_š™˜—
PS1=[\h]%\040
PS2=> 
PS4=+ 
PWD=/c/vcpower
SHELL=c:\dos\command.com
SHLVL=1
SYSROOT=c:
TEMP=c:\djgpp\tmp
TERM=nnansi
TMP=c:\djgpp\tmp
TMPDIR=d:/
UID=42
USER=jeffw
_=env

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019