Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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)
  8. all: $(GLIBC_TARGET)
  9. $(MAKE) -C $(SHIM_DIR) all
  10. install:
  11. [ -d ../Runtime ] || mkdir -p ../Runtime
  12. [ -f ../Runtime/libsysdb.so ] || ln -sf ../LibOS/shim/src/libsysdb.so ../Runtime/libsysdb.so
  13. ./buildglibc.py install --quiet
  14. ifeq ($(SYS),x86_64-linux-gnu)
  15. $(GLIBC_TARGET): $(BUILD_DIR)/Makefile
  16. cd $(BUILD_DIR) && $(MAKE)
  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. clean:
  35. $(MAKE) -C $(SHIM_DIR) clean
  36. rm -rf $(BUILD_DIR)
  37. else
  38. $(GLIBC_TARGET): .packed/glibc.tar.gz
  39. tar -xmozf $< $@
  40. clean:
  41. rm -rf $(BUILD_DIR)
  42. endif