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
parent f39a28b7a9
commit b05d854432
3 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
OUTPUT = $(PWD)/output OUTPUT = $(CURDIR)/output
SOURCES = sources SOURCES = sources
CONFIG_SUB_REV = 3d5db9ebe860 CONFIG_SUB_REV = 3d5db9ebe860
@ -67,7 +67,7 @@ $(SOURCES)/config.sub: | $(SOURCES)
mkdir -p $@.tmp 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 && 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 && 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 $@) $@ mv $@.tmp/$(notdir $@) $@
rm -rf $@.tmp rm -rf $@.tmp
@ -75,7 +75,7 @@ $(SOURCES)/%: hashes/%.sha1 | $(SOURCES)
mkdir -p $@.tmp mkdir -p $@.tmp
cd $@.tmp && wget -c -O $(notdir $@) $(SITE)/$(notdir $@) cd $@.tmp && wget -c -O $(notdir $@) $(SITE)/$(notdir $@)
cd $@.tmp && touch $(notdir $@) cd $@.tmp && touch $(notdir $@)
cd $@.tmp && sha1sum -c $(PWD)/hashes/$(notdir $@).sha1 cd $@.tmp && sha1sum -c $(CURDIR)/hashes/$(notdir $@).sha1
mv $@.tmp/$(notdir $@) $@ mv $@.tmp/$(notdir $@) $@
rm -rf $@.tmp rm -rf $@.tmp

View File

@ -64,4 +64,4 @@
# target libraries with the following, but then gdb needs to be told # target libraries with the following, but then gdb needs to be told
# where to look for source files. # 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 BINUTILS_SRCDIR = BINUTILS_SRCDIR_not_set
GCC_SRCDIR = GCC_SRCDIR_not_set GCC_SRCDIR = GCC_SRCDIR_not_set
@ -51,7 +51,7 @@ FULL_TOOLCHAIN_CONFIG = --enable-languages=c,c++ \
--target=$(TARGET) --prefix= \ --target=$(TARGET) --prefix= \
--libdir=/lib --disable-multilib \ --libdir=/lib --disable-multilib \
--with-sysroot=$(SYSROOT) \ --with-sysroot=$(SYSROOT) \
--with-build-sysroot=$(PWD)/obj_sysroot \ --with-build-sysroot=$(CURDIR)/obj_sysroot \
--enable-tls \ --enable-tls \
--disable-libmudflap --disable-libsanitizer \ --disable-libmudflap --disable-libsanitizer \
--disable-gnu-indirect-function \ --disable-gnu-indirect-function \
@ -162,7 +162,7 @@ obj_musl/.lc_configured: | obj_toolchain/gcc/.lc_built obj_musl src_musl
touch $@ touch $@
obj_sysroot/.lc_headers: | obj_musl/.lc_configured obj_sysroot 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 $@ touch $@
obj_toolchain/$(TARGET)/libgcc/.lc_configured: | obj_sysroot/.lc_headers obj_toolchain/$(TARGET)/libgcc/.lc_configured: | obj_sysroot/.lc_headers
@ -177,7 +177,7 @@ obj_musl/.lc_built: | obj_musl/.lc_configured
touch $@ touch $@
obj_sysroot/.lc_libs: | obj_musl/.lc_built 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 $@ touch $@
obj_toolchain/.lc_built: | obj_toolchain/.lc_configured obj_toolchain/gcc/.lc_built obj_toolchain/.lc_built: | obj_toolchain/.lc_configured obj_toolchain/gcc/.lc_built
@ -203,8 +203,8 @@ kernel-headers: | obj_kernel_headers/.lc_built
src_kernel_headers: | $(LINUX_SRCDIR) src_kernel_headers: | $(LINUX_SRCDIR)
ln -sf "$(LINUX_SRCDIR)" $@ ln -sf "$(LINUX_SRCDIR)" $@
obj_kernel_headers/.lc_built: | src_kernel_headers obj_kernel_headers/.lc_built: | src_kernel_headers
mkdir -p $(PWD)/obj_kernel_headers/staged mkdir -p $(CURDIR)/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 cd src_kernel_headers && $(MAKE) ARCH=$(LINUX_ARCH) O=$(CURDIR)/obj_kernel_headers INSTALL_HDR_PATH=$(CURDIR)/obj_kernel_headers/staged headers_install
touch $@ touch $@
install-kernel-headers: | obj_kernel_headers/.lc_built install-kernel-headers: | obj_kernel_headers/.lc_built
mkdir -p $(DESTDIR)$(OUTPUT)$(SYSROOT)/include mkdir -p $(DESTDIR)$(OUTPUT)$(SYSROOT)/include