Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. SYS ?= $(shell gcc -dumpmachine)
  2. export SYS
  3. export DEBUG
  4. GLIBC_SRC = glibc-2.19
  5. SHIM_DIR = shim
  6. BUILD_DIR = glibc-build
  7. GLIBC_TARGET = $(addprefix $(BUILD_DIR)/,libc.so.6 ld-linux-x86-64.so.2 libpthread.so.0 libm.so.6 libdl.so.2 libutil.so.1 crt1.o crti.o crtn.o liblibos.so.1 libnss_dns.so.2 libresolv.so.2)
  8. .PHONY: all
  9. all: $(GLIBC_TARGET)
  10. $(MAKE) -C $(SHIM_DIR) all
  11. ifeq ($(SYS),x86_64-linux-gnu)
  12. .INTERMEDIATE: $(BUILD_DIR)/Build.success
  13. $(BUILD_DIR)/Build.success: $(BUILD_DIR)/Makefile
  14. @echo "Building glibc, may take a while to finish. Warning messages may show up. If this process terminates with failures, see \"$(BUILD_DIR)/build.log\" for more information."
  15. cd $(BUILD_DIR) && (($(MAKE) >> build.log) 2>&1 | tee -a build.log)
  16. $(GLIBC_TARGET): $(BUILD_DIR)/Build.success
  17. $(BUILD_DIR)/Makefile: $(addprefix $(GLIBC_SRC)/,configure elf/Versions nptl/Versions dlfcn/Versions)
  18. ifeq ($(DEBUG),1)
  19. ./buildglibc.py --quiet --debug
  20. else
  21. ./buildglibc.py --quiet
  22. endif
  23. ifeq ($(shell git ls-files $(GLIBC_SRC)/configure),)
  24. $(GLIBC_SRC)/configure: $(GLIBC_SRC).patch
  25. [ -f $(GLIBC_SRC).tar.gz ] || \
  26. wget http://ftp.gnu.org/gnu/glibc/$(GLIBC_SRC).tar.gz
  27. tar -xzf $(GLIBC_SRC).tar.gz
  28. cd $(GLIBC_SRC) && patch -p1 < ../$(GLIBC_SRC).patch
  29. endif
  30. .PHONY: pack
  31. pack: $(GLIBC_TARGET)
  32. @../Scripts/pack_binaries.sh glibc $^
  33. $(MAKE) -C $(SHIM_DIR) pack
  34. .PHONY: clean
  35. clean:
  36. $(MAKE) -C $(SHIM_DIR) clean
  37. rm -rf $(BUILD_DIR)
  38. else
  39. $(GLIBC_TARGET): .packed/glibc.tar.gz
  40. tar -xmozf $< $@
  41. .PHONY: clean
  42. clean:
  43. rm -rf $(BUILD_DIR)
  44. endif