Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. TOPDIR = ../../
  2. include $(TOPDIR)Rules.mak
  3. UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
  4. GCC_BIN = $(shell which $(CC))
  5. LD_BIN = $(shell which $(LD))
  6. GCC_LIB = $(shell $(CC) -print-libgcc-file-name )
  7. #GCCINCDIR inherited from Rules.mak
  8. all: gcc-uClibc ld-uClibc
  9. gcc-uClibc.h: $(TOPDIR)/Config
  10. @echo "/* this file was autogenerated by make */" > gcc-uClibc.h
  11. @echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> gcc-uClibc.h
  12. @echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h
  13. @echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
  14. @echo "#define GCC_LIB " \"$(GCC_LIB)\" >> gcc-uClibc.h
  15. @echo "#define GCC_INCDIR " \"-I$(GCCINCDIR)/\" >> gcc-uClibc.h
  16. @echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> gcc-uClibc.h
  17. @echo "#define DYNAMIC_LINKER " \"$(DYNAMIC_LINKER)\" >> gcc-uClibc.h
  18. @echo "#define BUILD_DYNAMIC_LINKER " \"$(UCLIBC_DIR)/lib/$(UCLIBC_LDSO)\" >> gcc-uClibc.h
  19. gcc-uClibc: gcc-uClibc.h gcc-uClibc.c
  20. gcc -Wall -O2 -s gcc-uClibc.c -o $(TARGET_ARCH)-uclibc-gcc
  21. ld-uClibc:
  22. @echo "#!/bin/sh" > $(TARGET_ARCH)-uclibc-ld
  23. @echo "# This file was autogenerated by make" >> $(TARGET_ARCH)-uclibc-ld
  24. @echo "$(LD_BIN) -L- -L$(DEVEL_PREFIX)/lib -L$(DEVEL_PREFIX)/usr/lib "\
  25. "-L$(UCLIBC_DIR) \$$@" >> $(TARGET_ARCH)-uclibc-ld
  26. chmod a+x $(TARGET_ARCH)-uclibc-ld
  27. install: all
  28. install -d $(DEVEL_PREFIX)/bin;
  29. install -d $(DEVEL_PREFIX)/usr/bin;
  30. install -m 755 $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/usr/bin/
  31. install -m 755 $(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)/usr/bin/
  32. ln -fs $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-cc
  33. ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/gcc
  34. ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/cc
  35. ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)/bin/ld
  36. for app in addr2line ar as cpp gasp nm objcopy \
  37. objdump ranlib size strings strip; do \
  38. ln -fs `which $(CROSS)$${app}` $(DEVEL_PREFIX)/bin/$${app}; \
  39. ln -fs `which $(CROSS)$${app}` $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-$${app}; \
  40. done
  41. clean:
  42. rm -f gcc-uClibc.h *-uclibc-gcc *-uclibc-ld core