Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

83 Zeilen
2.2 KiB

  1. # Makefile is here to make it possible to use this whole shebang
  2. # outside of emacs.
  3. #
  4. # TODO: wrap this stuff into a script maybe?
  5. DEST:=$(HOME)
  6. LAST!=cat .last || echo 0
  7. NEXT!=l=$(LAST); ((l=l+1)); echo $$l
  8. NEXTGEN:=$(PWD)/generation/$(NEXT)
  9. LASTGEN:=$(PWD)/generation/$(LAST)
  10. TANGLERS:=$(wildcard *.org)
  11. GEN:=$(LAST)
  12. OPTS:=
  13. # OSX uses scutil --get ComputerName
  14. # uname -n && hostname -s can return dhcp addresses
  15. # which aren't stable.
  16. HOST!=scutil --get ComputerName || uname -n
  17. USEROPTS:=$(OPTS):$(HOST)
  18. # Make it easier to check if a variable is defined or not
  19. # params:
  20. # variable name
  21. # optional message to print if variable is not set
  22. check_defined = \
  23. $(strip $(foreach 1,$1, \
  24. $(call __check_defined,$1,$(strip $(value 2)))))
  25. __check_defined = \
  26. $(if $(value $1),, \
  27. $(error Undefined variable $1$(if $2, ($2))))
  28. INSTALLDIRS=tmp $(NEXTGEN) $(LASTGEN) generation/$(GEN)
  29. all: clean tangle-next
  30. $(INSTALLDIRS):
  31. install -dm755 $@
  32. generation: $(NEXTGEN) $(LASTGEN) tmp
  33. cd tmp && cp -av . $(NEXTGEN)
  34. diff: generation/$(GEN)
  35. ./ddiff $(PWD)/generation/$(GEN) $(DEST)
  36. next: diff
  37. .PHONY: tangle-next
  38. tangle-next:
  39. @echo Tangling for hostname $(HOST)
  40. $(MAKE) tangle
  41. $(MAKE) generation
  42. $(MAKE) next
  43. $(MAKE) copy GEN=$(NEXT)
  44. @echo $(NEXT) > .last
  45. @echo Tangled for hostname $(HOST)
  46. copy:
  47. cd $(PWD)/generation/$(GEN) && find . -type f -exec rm -f $(DEST)/{} \;
  48. cd $(PWD)/generation/$(GEN) && cp -r . $(DEST)
  49. .PHONY: tangle
  50. tangle: tmp
  51. USEROPTS=$(USEROPTS) /usr/bin/env emacs --script ./etangle $(TANGLERS)
  52. # TODO: is this gnu diff output... only or not? note: wip until i've
  53. # tested on bsd make etc...
  54. .PHONY: removed
  55. removed:
  56. $(call check_defined, OLD, generation to compare removed files against)
  57. $(call check_defined, NEW, generation to compare removed files to)
  58. @diff -bur generation/$(OLD) generation/$(NEW) 2>&1 | grep 'Only in generation/'$(OLD) | sed -e 's|Only in ||' -e 's|.*[:] ||'
  59. clean:
  60. -rm -fr tmp
  61. nuke: clean
  62. -rm -fr .last generation
  63. .PHONY: option
  64. option:
  65. $(call check_defined, NAME, predicate NAME to define in option files. Note: without -p i.e. NAME-p = t and no-NAME-p = nil)
  66. echo "(setq $(NAME)-p t)" > options/$(NAME).el
  67. echo "(setq $(NAME)-p nil)" > options/no-$(NAME).el