Use $(CURDIR) instead of $(PWD) in Makefile

Some shells (in particular ksh) don't export PWD by default, so it
doesn't end up as a make variable.
This commit is contained in:
Michael Forney 2016-12-01 23:14:01 -08:00 committed by Rich Felker
parent 3ac08b98c1
commit 53dd1fbd2c
3 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
OUTPUT = $(PWD)/output
OUTPUT = $(CURDIR)/output
SOURCES = sources
CONFIG_SUB_REV = 3d5db9ebe860
@ -67,7 +67,7 @@ $(SOURCES)/config.sub: | $(SOURCES)
mkdir -p $@.tmp
cd $@.tmp && wget -c -O $(notdir $@) "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=$(CONFIG_SUB_REV)"
cd $@.tmp && touch $(notdir $@)
cd $@.tmp && sha1sum -c $(PWD)/hashes/$(notdir $@).$(CONFIG_SUB_REV).sha1
cd $@.tmp && sha1sum -c $(CURDIR)/hashes/$(notdir $@).$(CONFIG_SUB_REV).sha1
mv $@.tmp/$(notdir $@) $@
rm -rf $@.tmp
@ -75,7 +75,7 @@ $(SOURCES)/%: hashes/%.sha1 | $(SOURCES)
mkdir -p $@.tmp
cd $@.tmp && wget -c -O $(notdir $@) $(SITE)/$(notdir $@)
cd $@.tmp && touch $(notdir $@)
cd $@.tmp && sha1sum -c $(PWD)/hashes/$(notdir $@).sha1
cd $@.tmp && sha1sum -c $(CURDIR)/hashes/$(notdir $@).sha1
mv $@.tmp/$(notdir $@) $@
rm -rf $@.tmp

View File

@ -64,4 +64,4 @@
# target libraries with the following, but then gdb needs to be told
# where to look for source files.
# COMMON_CONFIG += --with-debug-prefix-map=$(PWD)=
# COMMON_CONFIG += --with-debug-prefix-map=$(CURDIR)=

View File

@ -1,5 +1,5 @@
OUTPUT = $(PWD)/output
OUTPUT = $(CURDIR)/output
BINUTILS_SRCDIR = BINUTILS_SRCDIR_not_set
GCC_SRCDIR = GCC_SRCDIR_not_set
@ -52,7 +52,7 @@ FULL_TOOLCHAIN_CONFIG = --enable-languages=c,c++ \
--target=$(TARGET) --prefix= \
--libdir=/lib --disable-multilib \
--with-sysroot=$(SYSROOT) \
--with-build-sysroot=$(PWD)/obj_sysroot \
--with-build-sysroot=$(CURDIR)/obj_sysroot \
--enable-tls \
--disable-libmudflap --disable-libsanitizer \
--disable-gnu-indirect-function \
@ -163,7 +163,7 @@ obj_musl/.lc_configured: | obj_toolchain/gcc/.lc_built obj_musl src_musl
touch $@
obj_sysroot/.lc_headers: | obj_musl/.lc_configured obj_sysroot
cd obj_musl && $(MAKE) DESTDIR=$(PWD)/obj_sysroot install-headers
cd obj_musl && $(MAKE) DESTDIR=$(CURDIR)/obj_sysroot install-headers
touch $@
obj_toolchain/$(TARGET)/libgcc/.lc_configured: | obj_sysroot/.lc_headers
@ -178,7 +178,7 @@ obj_musl/.lc_built: | obj_musl/.lc_configured
touch $@
obj_sysroot/.lc_libs: | obj_musl/.lc_built
cd obj_musl && $(MAKE) $(MUSL_VARS) DESTDIR=$(PWD)/obj_sysroot install
cd obj_musl && $(MAKE) $(MUSL_VARS) DESTDIR=$(CURDIR)/obj_sysroot install
touch $@
obj_toolchain/.lc_built: | obj_toolchain/.lc_configured obj_toolchain/gcc/.lc_built
@ -204,8 +204,8 @@ kernel-headers: | obj_kernel_headers/.lc_built
src_kernel_headers: | $(LINUX_SRCDIR)
ln -sf "$(LINUX_SRCDIR)" $@
obj_kernel_headers/.lc_built: | src_kernel_headers
mkdir -p $(PWD)/obj_kernel_headers/staged
cd src_kernel_headers && $(MAKE) ARCH=$(LINUX_ARCH) O=$(PWD)/obj_kernel_headers INSTALL_HDR_PATH=$(PWD)/obj_kernel_headers/staged headers_install
mkdir -p $(CURDIR)/obj_kernel_headers/staged
cd src_kernel_headers && $(MAKE) ARCH=$(LINUX_ARCH) O=$(CURDIR)/obj_kernel_headers INSTALL_HDR_PATH=$(CURDIR)/obj_kernel_headers/staged headers_install
find obj_kernel_headers/staged/include '(' -name .install -o -name ..install.cmd ')' -exec rm {} +
touch $@
install-kernel-headers: | obj_kernel_headers/.lc_built