codebase: Change makefile $(shell pwd) commands to $(CURDIR)

- Change the makefile command $(shell pwd) to $(CURDIR) to find the
current directory without going out to the shell.

Change-Id: I4890eba6129630acd2883b92de77308d39949443
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/13967
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Martin Roth 2016-03-08 12:32:40 -07:00
parent 00e49aed52
commit 6116f369e9
7 changed files with 19 additions and 19 deletions

View File

@ -20,7 +20,7 @@ CONFIG_BUILTIN_LAR=y
PBUILDER_CONFIG=bayou.xml PBUILDER_CONFIG=bayou.xml
BUILTIN_LAR=builtin.lar BUILTIN_LAR=builtin.lar
export src := $(shell pwd) export src := $(CURDIR)
export obj := $(src)/build export obj := $(src)/build
LIBPAYLOAD_DIR := $(obj)/libpayload LIBPAYLOAD_DIR := $(obj)/libpayload

View File

@ -30,29 +30,29 @@ $(obj)/util/lzma/:
$(Q)mkdir -p $(obj)/util/lzma/ $(Q)mkdir -p $(obj)/util/lzma/
$(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Compress/LZMA/%.cpp $(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Compress/LZMA/%.cpp
$(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " HOSTCXX $(subst $(CURDIR)/,,$(@))\n"
$(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $< $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $<
$(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Compress/LZ/%.cpp $(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Compress/LZ/%.cpp
$(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " HOSTCXX $(subst $(CURDIR)/,,$(@))\n"
$(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $< $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $<
$(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Compress/RangeCoder/%.cpp $(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Compress/RangeCoder/%.cpp
$(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " HOSTCXX $(subst $(CURDIR)/,,$(@))\n"
$(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $< $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $<
$(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Decompress/%.cpp $(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Decompress/%.cpp
$(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " HOSTCXX $(subst $(CURDIR)/,,$(@))\n"
$(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $< $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $<
$(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Common/%.cpp $(obj)/util/lzma/%.o: $(src)/util/lzma/C/7zip/Common/%.cpp
$(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " HOSTCXX $(subst $(CURDIR)/,,$(@))\n"
$(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $< $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $<
$(obj)/util/lzma/%.o: $(src)/util/lzma/C/Common/%.cpp $(obj)/util/lzma/%.o: $(src)/util/lzma/C/Common/%.cpp
$(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " HOSTCXX $(subst $(CURDIR)/,,$(@))\n"
$(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $< $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $<
$(obj)/util/lzma/%.o: $(src)/util/lzma/%.cc $(obj)/util/lzma/%.o: $(src)/util/lzma/%.cc
$(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" $(Q)printf " HOSTCXX $(subst $(CURDIR)/,,$(@))\n"
$(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $< $(Q)$(HOSTCXX) $(HOSTCXXFLAGS) -o $@ -c $<

View File

@ -14,7 +14,7 @@
## GNU General Public License for more details. ## GNU General Public License for more details.
## ##
src := $(shell pwd) src := $(CURDIR)
srctree := $(src) srctree := $(src)
srck := $(src)/../../util/kconfig srck := $(src)/../../util/kconfig
coreinfo_obj := $(src)/build coreinfo_obj := $(src)/build
@ -88,18 +88,18 @@ include $(src)/.config
real-all: $(TARGET) real-all: $(TARGET)
$(TARGET): $(src)/.config $(coreinfo_obj)/config.h $(OBJS) libpayload $(TARGET): $(src)/.config $(coreinfo_obj)/config.h $(OBJS) libpayload
printf " LPCC $(subst $(shell pwd)/,,$(@)) (LINK)\n" printf " LPCC $(subst $(CURDIR)/,,$(@)) (LINK)\n"
$(LPCC) -o $@ $(OBJS) $(LPCC) -o $@ $(OBJS)
$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug $(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
$(OBJCOPY) --strip-debug $@ $(OBJCOPY) --strip-debug $@
$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@ $(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
$(coreinfo_obj)/%.S.o: $(src)/%.S libpayload $(coreinfo_obj)/%.S.o: $(src)/%.S libpayload
printf " LPAS $(subst $(shell pwd)/,,$(@))\n" printf " LPAS $(subst $(CURDIR)/,,$(@))\n"
$(LPAS) -o $@ $< $(LPAS) -o $@ $<
$(coreinfo_obj)/%.o: $(src)/%.c libpayload $(coreinfo_obj)/%.o: $(src)/%.c libpayload
printf " LPCC $(subst $(shell pwd)/,,$(@))\n" printf " LPCC $(subst $(CURDIR)/,,$(@))\n"
$(LPCC) $(CFLAGS) -c -o $@ $< $(LPCC) $(CFLAGS) -c -o $@ $<
else else

View File

@ -14,7 +14,7 @@
## ##
project_name=Memtest86+ project_name=Memtest86+
project_dir=$(shell pwd)/memtest86plus project_dir=$(CURDIR)/memtest86plus
project_git_repo=https://review.coreboot.org/memtest86plus project_git_repo=https://review.coreboot.org/memtest86plus
all: build all: build

View File

@ -75,22 +75,22 @@ lib: $$(library-targets) $(obj)/head.o
extract_nth=$(word $(1), $(subst |, ,$(2))) extract_nth=$(word $(1), $(subst |, ,$(2)))
####################################################################### #######################################################################
# Add handler for special include files # Add handler for special include files
$(call add-special-class,includes) $(call add-special-class,includes)
includes-handler= \ includes-handler= \
$(if $(wildcard $(1)$(call extract_nth,1,$(2))), \ $(if $(wildcard $(1)$(call extract_nth,1,$(2))), \
$(eval includes += $(1)$(2))) $(eval includes += $(1)$(2)))
$(obj)/libpayload.a: $(foreach class,$(libraries),$$($(class)-objs)) $(obj)/libpayload.a: $(foreach class,$(libraries),$$($(class)-objs))
printf " AR $(subst $(shell pwd)/,,$(@))\n" printf " AR $(subst $(CURDIR)/,,$(@))\n"
$(AR) rc $@ $^ $(AR) rc $@ $^
$(obj)/%.a: $$(%-objs) $(obj)/%.a: $$(%-objs)
printf " AR $(subst $(shell pwd)/,,$(@))\n" printf " AR $(subst $(CURDIR)/,,$(@))\n"
$(AR) rc $@ $^ $(AR) rc $@ $^
$(obj)/head.o: $(obj)/arch/$(ARCHDIR-y)/head.head.o.o $(obj)/head.o: $(obj)/arch/$(ARCHDIR-y)/head.head.o.o
printf " CP $(subst $(shell pwd)/,,$(@))\n" printf " CP $(subst $(CURDIR)/,,$(@))\n"
cp $^ $@ cp $^ $@
install: real-target install: real-target

View File

@ -1,4 +1,4 @@
obj ?= $(shell pwd) obj ?= $(CURDIR)
HOSTCC ?= gcc HOSTCC ?= gcc
CFLAGS ?= -g CFLAGS ?= -g

View File

@ -21,7 +21,7 @@ PROGRAM = viatool
CC ?= gcc CC ?= gcc
INSTALL ?= /usr/bin/install INSTALL ?= /usr/bin/install
PREFIX ?= /usr/local PREFIX ?= /usr/local
CFLAGS ?= -O2 -g -Wall -W -I$(shell pwd) CFLAGS ?= -O2 -g -Wall -W -I$(CURDIR)
LDFLAGS += -lpci -lz LDFLAGS += -lpci -lz
SRCS = viatool.c \ SRCS = viatool.c \