From bad55804920a02de31b3846baba17c17f8fff837 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 22 May 2013 21:21:12 +0000 Subject: [PATCH] [make] Use less shell variables Use fixed variables for things that can't change, instead of variables like SRCLIBDIR that was causing a shell call for every single use. Use less functions in general and less shell expansions. Use builtin functions like $(realpath blah) instead of $(shell pwd)/blah In particular, this was important for me trying to build on windows with git-shell. This should help a lot on smaller build machines, but doesn't make a huge difference on my own. Remove redundant clean print messages. These also cause more needless shell expansions. --- Makefile | 12 ++++++------ lib/Makefile.include | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 18950f8a..14e53a51 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,13 @@ else DESTDIR ?= $(shell dirname $(shell readlink -f $(shell which $(PREFIX)-gcc)))/.. endif -INCDIR = $(DESTDIR)/$(PREFIX)/include -LIBDIR = $(DESTDIR)/$(PREFIX)/lib -SHAREDIR = $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts -INSTALL = install +INCDIR := $(DESTDIR)/$(PREFIX)/include +LIBDIR := $(DESTDIR)/$(PREFIX)/lib +SHAREDIR := $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts +INSTALL := install -SRCLIBDIR = $(shell pwd)/lib -TARGETS = stm32/f1 stm32/f2 stm32/f4 stm32/l1 lpc13xx lpc17xx lpc43xx lm3s lm4f efm32/efm32tg efm32/efm32g efm32/efm32lg efm32/efm32gg sam/3x sam/3n +SRCLIBDIR:= $(realpath lib) +TARGETS:= stm32/f1 stm32/f2 stm32/f4 stm32/l1 lpc13xx lpc17xx lpc43xx lm3s lm4f efm32/efm32tg efm32/efm32g efm32/efm32lg efm32/efm32gg sam/3x sam/3n # Be silent per default, but 'make V=1' will show all compiler calls. ifneq ($(V),1) diff --git a/lib/Makefile.include b/lib/Makefile.include index 7b76d649..e109d339 100644 --- a/lib/Makefile.include +++ b/lib/Makefile.include @@ -29,20 +29,19 @@ OBJS += vector.o systick.o scb.o nvic.o assert.o sync.o all: $(SRCLIBDIR)/$(LIBNAME).a $(SRCLIBDIR)/$(LIBNAME).a: $(SRCLIBDIR)/$(LIBNAME).ld $(OBJS) - @printf " AR $(shell basename $(@))\n" - $(Q)$(AR) $(ARFLAGS) $(SRCLIBDIR)/$(shell basename $(@)) $(OBJS) + @printf " AR $(@F)\n" + $(Q)$(AR) $(ARFLAGS) $@ $(OBJS) $(SRCLIBDIR)/$(LIBNAME).ld: $(LIBNAME).ld - @printf " CP $(LIBNAME).ld\n" + @printf " CP $(@F)\n" $(Q)cp $^ $@ $(Q)if [ -f $(LIBNAME)_rom_to_ram.ld ]; then cp $(LIBNAME)_rom_to_ram.ld $(SRCLIBDIR); fi %.o: %.c - @printf " CC $(subst $(shell pwd)/,,$(@))\n" + @printf " CC $(