You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

66 lines
1.5 KiB

  1. outdir = $(DESTDIR)/$(dir)
  2. define check_destdir
  3. @if [ -z "$(DESTDIR)" ]; then \
  4. echo "You *must* give a DESTDIR!"; \
  5. exit 1; \
  6. fi
  7. endef
  8. build: build-local build-recursive
  9. build-local::
  10. install: install-auto install-local install-recursive
  11. install-auto: $(outdir) install-auto-dirs install-auto-files install-auto-files-exec
  12. install-auto-dirs:
  13. $(call check_destdir)
  14. @list='$(subdirs_empty)'; for file in $$list; do \
  15. echo "install -d -m755 $(outdir)/$$file"; \
  16. install -d -m755 $(outdir)/$$file; \
  17. done
  18. install-auto-files:
  19. $(call check_destdir)
  20. @list='$(files)'; for file in $$list; do \
  21. case $$file in \
  22. *:*) in=`echo "$$file" | sed 's,[^:]*:,,'` \
  23. out=$(outdir)/`echo "$$file" | sed 's,:.*,,'`;; \
  24. *) in=$$file out=$(outdir);; \
  25. esac; \
  26. echo "install -m644 $$in $$out"; \
  27. install -m644 $$in $$out; \
  28. done
  29. install-auto-files-exec:
  30. $(call check_destdir)
  31. @list='$(files_exec)'; for file in $$list; do \
  32. case $$file in \
  33. *:*) in=`echo "$$file" | sed 's,[^:]*:,,'` \
  34. out=$(outdir)/`echo "$$file" | sed 's,:.*,,'`;; \
  35. *) in=$$file out=$(outdir);; \
  36. esac; \
  37. echo "install -m755 $$in $$out"; \
  38. install -m755 $$in $$out; \
  39. done
  40. install-local::
  41. clean: clean-local clean-recursive
  42. clean-local::
  43. build-recursive clean-recursive install-recursive:
  44. @target=`echo $@ | sed s/-recursive//`; \
  45. list='$(subdirs)'; \
  46. for subdir in $$list; do \
  47. echo "Making $$target in $$subdir"; \
  48. (cd $$subdir && $(MAKE) $$target) || exit 1; \
  49. done
  50. $(outdir):
  51. install -d $(outdir)