Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: $(GLIBC_SRC)/configure
  18. ifeq ($(DEBUG),1)
  19. ./buildglibc.py --quiet --debug
  20. else
  21. ./buildglibc.py --quiet
  22. endif
  23. $(GLIBC_SRC)/configure:
  24. [ -f $(GLIBC_SRC).tar.gz ] || \
  25. wget http://ftp.gnu.org/gnu/glibc/$(GLIBC_SRC).tar.gz
  26. tar -xzf $(GLIBC_SRC).tar.gz
  27. cd $(GLIBC_SRC) && patch -p1 < ../$(GLIBC_SRC).patch
  28. .PHONY: pack
  29. pack: $(GLIBC_TARGET)
  30. @../Scripts/pack_binaries.sh glibc $^
  31. $(MAKE) -C $(SHIM_DIR) pack
  32. clean:
  33. $(MAKE) -C $(SHIM_DIR) clean
  34. rm -rf $(BUILD_DIR)
  35. else
  36. $(GLIBC_TARGET): .packed/glibc.tar.gz
  37. tar -xmozf $< $@
  38. clean:
  39. rm -rf $(BUILD_DIR)
  40. endif