Makefile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. all: $(GLIBC_TARGET)
  9. $(MAKE) -C $(SHIM_DIR) all
  10. ifeq ($(SYS),x86_64-linux-gnu)
  11. $(GLIBC_TARGET): $(BUILD_DIR)/Makefile
  12. cd $(BUILD_DIR) && $(MAKE)
  13. $(BUILD_DIR)/Makefile: $(addprefix $(GLIBC_SRC)/,configure elf/Versions nptl/Versions dlfcn/Versions)
  14. ifeq ($(DEBUG),1)
  15. ./buildglibc.py --quiet --debug
  16. else
  17. ./buildglibc.py --quiet
  18. endif
  19. ifeq ($(shell git ls-files $(GLIBC_SRC)/configure),)
  20. $(GLIBC_SRC)/configure: $(GLIBC_SRC).patch
  21. [ -f $(GLIBC_SRC).tar.gz ] || \
  22. wget http://ftp.gnu.org/gnu/glibc/$(GLIBC_SRC).tar.gz
  23. tar -xzf $(GLIBC_SRC).tar.gz
  24. cd $(GLIBC_SRC) && patch -p1 < ../$(GLIBC_SRC).patch
  25. endif
  26. .PHONY: pack
  27. pack: $(GLIBC_TARGET)
  28. @../Scripts/pack_binaries.sh glibc $^
  29. $(MAKE) -C $(SHIM_DIR) pack
  30. clean:
  31. $(MAKE) -C $(SHIM_DIR) clean
  32. rm -rf $(BUILD_DIR)
  33. else
  34. $(GLIBC_TARGET): .packed/glibc.tar.gz
  35. tar -xmozf $< $@
  36. clean:
  37. rm -rf $(BUILD_DIR)
  38. endif