Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. reldir = $(shell p=`dirname $(1)` ; d=; while [ "$$p" != "." ]; do p=`dirname $$p`; d=../$$d; done; echo $$d)
  25. manifest_rules = \
  26. -e 's:\$$(PALDIR):$(PALDIR):g' \
  27. -e 's:\$$(PWD):$(PWD):g' \
  28. -e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
  29. -e 's:\$$(SHIMDIR):$(SHIMDIR):g' \
  30. -e 's:\$$(SHIMPATH):$(SHIMDIR)/libsysdb.so:g' \
  31. -e 's:\$$(LIBCDIR):$(LIBCDIR):g' \
  32. $(extra_rules)
  33. %manifest: %manifest.template
  34. @echo [ $@ ]
  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