Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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) 2>&1 >> build.log)
  16. # 2>&1 | tee -a build.log)
  17. $(GLIBC_TARGET): $(BUILD_DIR)/Build.success
  18. $(BUILD_DIR)/Makefile: $(addprefix $(GLIBC_SRC)/,configure elf/Versions nptl/Versions dlfcn/Versions)
  19. ifeq ($(DEBUG),1)
  20. ./buildglibc.py --quiet --debug
  21. else
  22. ./buildglibc.py --quiet
  23. endif
  24. ifeq ($(shell git ls-files $(GLIBC_SRC)/configure),)
  25. $(GLIBC_SRC)/configure: $(GLIBC_SRC).patch
  26. [ -f $(GLIBC_SRC).tar.gz ] || \
  27. wget http://ftp.gnu.org/gnu/glibc/$(GLIBC_SRC).tar.gz
  28. tar -xzf $(GLIBC_SRC).tar.gz
  29. cd $(GLIBC_SRC) && patch -p1 < ../$(GLIBC_SRC).patch
  30. endif
  31. .PHONY: clean
  32. clean:
  33. $(MAKE) -C $(SHIM_DIR) clean
  34. rm -rf $(BUILD_DIR)
  35. else
  36. .IGNORE: $(GLIBC_TARGET)
  37. $(GLIBC_TARGET):
  38. .PHONY: clean
  39. clean:
  40. rm -rf $(BUILD_DIR)
  41. endif