summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-10-13 08:34:51 +0000
committerEric Andersen <andersen@codepoet.org>2003-10-13 08:34:51 +0000
commit573ad7e58859d0e92a345654604f468ee4877e29 (patch)
tree807ec67da4c9addf55d7d94599ae3be41b06d8ab /extra
parente6e945c0a68c04ea6513b0fcd3867632c43d5840 (diff)
Patch from Peter Kjellerstedt:
The attached patch performs a clean up of extra/gcc-uClibc/Makefile: * Better dependencies to only rebuild what is necessary. * Use $< and $@ where appropriate. * Suppress warning messages from which about commands that cannot be found. //Peter
Diffstat (limited to 'extra')
-rw-r--r--extra/gcc-uClibc/Makefile76
1 files changed, 37 insertions, 39 deletions
diff --git a/extra/gcc-uClibc/Makefile b/extra/gcc-uClibc/Makefile
index 2693da127..07193ef14 100644
--- a/extra/gcc-uClibc/Makefile
+++ b/extra/gcc-uClibc/Makefile
@@ -7,60 +7,60 @@
TOPDIR = ../../
include $(TOPDIR)Rules.mak
-UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
-GCC_BIN = $(shell which $(CC))
-LD_BIN = $(shell which $(LD))
-GCCINCDIR:= ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
+UCLIBC_DIR := $(shell (cd $(TOPDIR); /bin/pwd))
+GCC_BIN := $(shell which $(CC))
+LD_BIN := $(shell which $(LD))
+GCCINCDIR := $(shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
-all: gcc-uClibc ld-uClibc
+all: $(TARGET_ARCH)-uclibc-gcc $(TARGET_ARCH)-uclibc-ld
-gcc-uClibc.h: Makefile $(TOPDIR)/.config
- @echo "/* this file was autogenerated by make */" > gcc-uClibc.h
- @echo "#define UCLIBC_TARGET_PREFIX " \"$(TARGET_PREFIX)\" >> gcc-uClibc.h
- @echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> gcc-uClibc.h
- @echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)\" >> gcc-uClibc.h
- @echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
- @echo "#define LIBGCC_DIR " \"$(LIBGCC_DIR)\" >> gcc-uClibc.h
- @echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> gcc-uClibc.h
- @echo "#define DYNAMIC_LINKER " \"$(DYNAMIC_LINKER)\" >> gcc-uClibc.h
- @echo "#define BUILD_DYNAMIC_LINKER " \"$(UCLIBC_DIR)/lib/$(UCLIBC_LDSO)\" >> gcc-uClibc.h
+gcc-uClibc.h: Makefile $(TOPDIR)/.config
+ @echo "/* this file was autogenerated by make */" > $@
+ @echo "#define UCLIBC_TARGET_PREFIX " \"$(TARGET_PREFIX)\" >> $@
+ @echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> $@
+ @echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)\" >> $@
+ @echo "#define GCC_BIN " \"$(GCC_BIN)\" >> $@
+ @echo "#define LIBGCC_DIR " \"$(LIBGCC_DIR)\" >> $@
+ @echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> $@
+ @echo "#define DYNAMIC_LINKER " \"$(DYNAMIC_LINKER)\" >> $@
+ @echo "#define BUILD_DYNAMIC_LINKER " \"$(UCLIBC_DIR)/lib/$(UCLIBC_LDSO)\" >> $@
ifeq ($(strip $(HAVE_SHARED)),y)
- @echo "#define __UCLIBC_HAS_SHARED__ 1" >> gcc-uClibc.h
+ @echo "#define __UCLIBC_HAS_SHARED__ 1" >> $@
else
- @echo "#undef __UCLIBC_HAS_SHARED__" >> gcc-uClibc.h
+ @echo "#undef __UCLIBC_HAS_SHARED__" >> $@
endif
ifeq ($(strip $(UCLIBC_HAS_MMU)),y)
- @echo "#define __UCLIBC_HAS_MMU__ 1" >> gcc-uClibc.h
+ @echo "#define __UCLIBC_HAS_MMU__ 1" >> $@
else
- @echo "#undef __UCLIBC_HAS_MMU__" >> gcc-uClibc.h
+ @echo "#undef __UCLIBC_HAS_MMU__" >> $@
endif
ifeq ($(strip $(HAS_ELF)),y)
- @echo "#define __HAS_ELF__ 1" >> gcc-uClibc.h
+ @echo "#define __HAS_ELF__ 1" >> $@
else
- @echo "#undef __HAS_ELF__" >> gcc-uClibc.h
+ @echo "#undef __HAS_ELF__" >> $@
endif
ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
- @echo "#define __UCLIBC_CTOR_DTOR__ 1" >> gcc-uClibc.h
+ @echo "#define __UCLIBC_CTOR_DTOR__ 1" >> $@
ifeq ($(strip $(UCLIBC_PROFILING)),y)
- @echo "#define __UCLIBC_PROFILING__ 1" >> gcc-uClibc.h
+ @echo "#define __UCLIBC_PROFILING__ 1" >> $@
else
- @echo "#undef __UCLIBC_PROFILING__" >> gcc-uClibc.h
+ @echo "#undef __UCLIBC_PROFILING__" >> $@
endif
else
- @echo "#undef __UCLIBC_CTOR_DTOR__" >> gcc-uClibc.h
+ @echo "#undef __UCLIBC_CTOR_DTOR__" >> $@
endif
-gcc-uClibc: gcc-uClibc.h gcc-uClibc.c
- $(HOSTCC) $(HOSTCFLAGS) -s gcc-uClibc.c -o $(TARGET_ARCH)-uclibc-gcc
+$(TARGET_ARCH)-uclibc-gcc: gcc-uClibc.c gcc-uClibc.h
+ $(HOSTCC) $(HOSTCFLAGS) -s $< -o $@
-ld-uClibc:
- @echo "#!/bin/sh" > $(TARGET_ARCH)-uclibc-ld
- @echo "# This file was autogenerated by make" >> $(TARGET_ARCH)-uclibc-ld
- @echo "$(LD_BIN) \$$@ -L$(DEVEL_PREFIX)/usr/lib -L$(DEVEL_PREFIX)/lib "\
- "-L$(UCLIBC_DIR)" >> $(TARGET_ARCH)-uclibc-ld
- chmod a+x $(TARGET_ARCH)-uclibc-ld
+$(TARGET_ARCH)-uclibc-ld: Makefile $(TOPDIR)/.config
+ @echo "#!/bin/sh" > $@
+ @echo "# This file was autogenerated by make" >> $@
+ @echo "exec $(LD_BIN) \"\$$@\" -L$(DEVEL_PREFIX)/usr/lib " \
+ "-L$(DEVEL_PREFIX)/lib -L$(UCLIBC_DIR)" >> $@
+ chmod a+x $@
-install: all
+install: all
install -d $(PREFIX)$(DEVEL_TOOL_PREFIX)/bin;
install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin;
install -m 755 $(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/
@@ -77,14 +77,12 @@ ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
endif
for app in addr2line ar as cpp gasp nm objcopy \
objdump ranlib size strings strip; do \
- APPNAME=`which $(CROSS)$${app}`; \
+ APPNAME=`which $(CROSS)$${app} 2>/dev/null`; \
if [ -x "$$APPNAME" ] ; then \
- ln -fs "$$APPNAME" $(PREFIX)$(DEVEL_TOOL_PREFIX)/bin/$${app}; \
- ln -fs "$$APPNAME" $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-$${app}; \
+ ln -fs "$$APPNAME" $(PREFIX)$(DEVEL_TOOL_PREFIX)/bin/$${app}; \
+ ln -fs "$$APPNAME" $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-$${app}; \
fi; \
done
clean:
rm -f gcc-uClibc.h *-uclibc-gcc *-uclibc-ld core
-
-