Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. TOPDIR = ../../
  2. include $(TOPDIR)Rules.mak
  3. # NOTE: This may need to be modified on each system.
  4. # If your default dynamic linker works, comment this out.
  5. DYNAMIC_LINKER = /lib/ld-linux.so.1
  6. UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
  7. GCC_BIN = $(CC)
  8. GCC_LIB = $(shell $(CC) -print-libgcc-file-name )
  9. #GCCINCDIR inherited from Rules.mak
  10. NATIVE_ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/')
  11. GCC_UCLIBC = gcc-uClibc-cross
  12. ifeq ($(TARGET_ARCH), $(NATIVE_ARCH))
  13. GCC_UCLIBC = gcc-uClibc-native
  14. endif
  15. all: $(GCC_UCLIBC)
  16. clean:
  17. rm -f gcc-uClibc.h gcc-uClibc-* core
  18. gcc-uClibc.h: clean
  19. echo "/* this file is created by make */" > gcc-uClibc.h
  20. echo "#define UCLIBC_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h
  21. echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
  22. echo "#define GCC_LIB " \"$(GCC_LIB)\" >> gcc-uClibc.h
  23. echo "#define GCC_INCDIR " \"-I$(GCCINCDIR)/\" >> gcc-uClibc.h
  24. echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> gcc-uClibc.h
  25. echo "#define DYNAMIC_LINKER " \"$(DYNAMIC_LINKER)\" >> gcc-uClibc.h
  26. gcc-uClibc-native: gcc-uClibc.h gcc-uClibc.c
  27. # uClibc built for native environment, so why not use it ;-)
  28. $(CC) $(CFLAGS) -nostdinc -I$(UCLIBC_DIR)/include -I$(GCC_INC) \
  29. -Wl,-static gcc-uClibc.c \
  30. $(UCLIBC_DIR)/crt0.o \
  31. -nostdlib $(GCC_LIB) $(UCLIBC_DIR)/libc.a \
  32. -s -o gcc-uClibc-$(TARGET_ARCH) #-DDEBUG
  33. gcc-uClibc-cross: gcc-uClibc.h gcc-uClibc.c
  34. # don't use CFLAGS since may not be appropriate
  35. gcc -s gcc-uClibc.c -o gcc-uClibc-$(TARGET_ARCH)