Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. TOPDIR = ../../
  2. include $(TOPDIR)Rules.mak
  3. # NOTE: This may need to be modified on each system.
  4. ifeq ($(TARGET_ARCH), i386)
  5. # Right now, I'm using .1 since .2 pulls in libc6 on my system. Manuel
  6. DYNAMIC_LINKER = /lib/ld-linux.so.1
  7. else
  8. # For Erik's arm case.
  9. DYNAMIC_LINKER = $(shell ls /lib/ld*.so.[0-9] | sort | tail -n 1)
  10. endif
  11. UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
  12. GCC_BIN = $(CC)
  13. GCC_LIB = $(shell $(CC) -print-libgcc-file-name )
  14. #GCCINCDIR inherited from Rules.mak
  15. NATIVE_ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/')
  16. GCC_UCLIBC = gcc-uClibc-cross
  17. ifeq ($(TARGET_ARCH), $(NATIVE_ARCH))
  18. GCC_UCLIBC = gcc-uClibc-native
  19. endif
  20. all: $(GCC_UCLIBC)
  21. clean:
  22. rm -f gcc-uClibc.h gcc-uClibc-* core
  23. gcc-uClibc.h: clean
  24. @echo "/* this file is created by make */" > gcc-uClibc.h
  25. @echo "#define UCLIBC_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h
  26. @echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
  27. @echo "#define GCC_LIB " \"$(GCC_LIB)\" >> gcc-uClibc.h
  28. @echo "#define GCC_INCDIR " \"-I$(GCCINCDIR)/\" >> gcc-uClibc.h
  29. @echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> gcc-uClibc.h
  30. @echo "#define DYNAMIC_LINKER " \"$(DYNAMIC_LINKER)\" >> gcc-uClibc.h
  31. # uClibc built for native environment, so why not use it ;-)
  32. # Use the system libc instead of uClibc, to facilitate bootstrapping
  33. # new architectures.
  34. #gcc-uClibc-native: gcc-uClibc.h gcc-uClibc.c
  35. # $(CC) $(CFLAGS) -nostdinc -I$(UCLIBC_DIR)/include -I$(GCC_INC) \
  36. # -Wl,-static gcc-uClibc.c \
  37. # $(UCLIBC_DIR)/crt0.o \
  38. # -nostdlib $(GCC_LIB) $(UCLIBC_DIR)/libc.a \
  39. # -s -o gcc-uClibc-$(TARGET_ARCH) #-DDEBUG
  40. gcc-uClibc-native: gcc-uClibc.h gcc-uClibc.c
  41. # don't use CFLAGS since may not be appropriate
  42. gcc -s gcc-uClibc.c -o gcc-uClibc-$(TARGET_ARCH)
  43. gcc-uClibc-cross: gcc-uClibc.h gcc-uClibc.c
  44. # don't use CFLAGS since may not be appropriate
  45. gcc -s gcc-uClibc.c -o gcc-uClibc-$(TARGET_ARCH)