Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. subdirs = native
  2. SYS ?= $(shell gcc -dumpmachine)
  3. export SYS
  4. PALDIR = $(level)../../../Pal/src
  5. SHIMDIR = $(level)../src
  6. LIBCDIR = $(level)../../glibc-build
  7. CC = gcc
  8. CXX = g++
  9. CFLAGS = -std=gnu99
  10. CFLAGS-debug = $(CFLAGS) -I$(PALDIR)/../include/pal -I$(PALDIR)/../lib
  11. LDFLAGS =
  12. LDFLAGS-debug = $(LDFLAGS) -L$(SHIMDIR) \
  13. -Wl,-rpath-link=$(abspath $(SHIMDIR)) \
  14. -Wl,-rpath-link=$(abspath $(PALDIR)) \
  15. -lpal -lsysdb_debug
  16. default: all
  17. include $(PALDIR)/Makefile.Test
  18. all: $(target) $(if $(level),,build-subdirs) | $(call expand_target,$(exec_target))
  19. ifeq ($(DEBUG),1)
  20. CC += -g
  21. CXX += -g
  22. endif
  23. export DEBUG
  24. manifest_rules = \
  25. -e 's:\$$(PALDIR):'$$RELDIR'$(PALDIR):g' \
  26. -e 's:\$$(PWD):$(PWD):g' \
  27. -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
  28. -e 's:\$$(SHIMDIR):'$$RELDIR'$(SHIMDIR):g' \
  29. -e 's:\$$(SHIMPATH):'$$RELDIR'$(SHIMDIR)/libsysdb.so:g' \
  30. -e 's:\$$(LIBCDIR):'$$RELDIR'$(LIBCDIR):g' \
  31. $(extra_rules)
  32. %manifest: %manifest.template
  33. @echo [ $@ ]
  34. RELDIR=$(filter-out ./,$(python -c "import os.path; print os.path.relpath($(abspath $(dir $@)) $(PWD))")) && \
  35. sed $(manifest_rules) $< > $@
  36. (grep -q '^#!' $@ && chmod +x $@) || true
  37. manifest: manifest.template
  38. @echo [ $@ ]
  39. sed $(manifest_rules) $< > $@
  40. pal pal_sec:
  41. ln -sf $(level)../../../Pal/src/$@ $@
  42. .PHONY: test clean
  43. clean: $(clean-extra) $(if $(level),,clean-subdirs)
  44. rm -rf $(call expand_target,$(exec_target)) $(target)
  45. build-subdirs:
  46. for f in $(subdirs); do (cd $$f; $(MAKE); cd ..); done
  47. ifeq ($(SYS),x86_64-linux-gnu)
  48. ifeq ($(level),)
  49. .PHONY: pack
  50. pack:
  51. for f in $(subdirs); do (cd $$f; $(MAKE) pack; cd ..); done
  52. endif
  53. endif
  54. clean-subdirs:
  55. for f in $(subdirs); do (cd $$f; $(MAKE) clean; cd ..); done