The repository formerly known as dotfiles
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.

Makefile 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. PREFIX = ~/.local
  2. MANDIR = $(PREFIX)/share/man
  3. GFX = cocoa
  4. CFLAGS += -Wall -Wextra -Wpedantic
  5. LDLIBS = -lm -lutil -lz
  6. LDLIBS_cocoa = $(LDLIBS) -framework Cocoa
  7. LDLIBS_fb = $(LDLIBS)
  8. LDLIBS_x11 = $(LDLIBS) -lX11
  9. BINS += aes
  10. BINS += dtch
  11. BINS += glitch
  12. BINS += hi
  13. BINS += hnel
  14. BINS += modem
  15. BINS += pbd
  16. BINS += pngo
  17. BINS += psf2png
  18. BINS += scheme
  19. BINS += setopt
  20. BINS += ttpre
  21. BINS += up
  22. BINS += wake
  23. BINS += xx
  24. LINKS += atch
  25. LINKS += open
  26. LINKS += pbcopy
  27. LINKS += pbpaste
  28. BINS_BSD += beef
  29. BINS_BSD += wat
  30. BINS_LINUX += bri
  31. BINS_LINUX += fbatt
  32. BINS_LINUX += fbclock
  33. BINS_LINUX += psfed
  34. BINS_GFX += brot
  35. BINS_GFX += gfxx
  36. BINS_ALL = $(BINS) $(BINS_BSD) $(BINS_LINUX) $(BINS_GFX)
  37. MAN1_ALL = $(BINS_ALL:%=man1/%.1)
  38. any: .gitignore tags $(BINS) $(LINKS)
  39. bsd: any $(BINS_BSD)
  40. linux: any $(BINS_LINUX)
  41. gfx: any $(BINS_GFX)
  42. .o:
  43. $(CC) $(LDFLAGS) $< $(LDLIBS) -o $@
  44. scheme.h: scheme
  45. ./scheme -c > scheme.h
  46. brot.o gfxx.o gfx-cocoa.o gfx-fb.o gfx-x11.o: gfx.h
  47. fbatt.o fbclock.o: scheme.h
  48. gfxx.o psf2png.o scheme.o: png.h
  49. GFX_OBJ = gfx-$(GFX).o
  50. brot: brot.o $(GFX_OBJ)
  51. $(CC) $(LDFLAGS) $@.o $(GFX_OBJ) $(LDLIBS_$(GFX)) -o $@
  52. gfxx: gfxx.o $(GFX_OBJ)
  53. $(CC) $(LDFLAGS) $@.o $(GFX_OBJ) $(LDLIBS_$(GFX)) -o $@
  54. hi: hi.c
  55. $(CC) $(CFLAGS) $(LDFLAGS) hi.c $(LDLIBS) -o $@
  56. ./hi -c
  57. atch: dtch
  58. ln -f dtch atch
  59. open pbcopy pbpaste: pbd
  60. ln -f pbd $@
  61. .gitignore: Makefile
  62. echo $(BINS_ALL) $(LINKS) tags scheme.h scheme.png '*.o' '*.html' \
  63. | tr ' ' '\n' | sort > .gitignore
  64. tags: *.h *.c
  65. ctags -w *.h *.c
  66. scheme.png: scheme
  67. ./scheme -gt > scheme.png
  68. HTMLS = $(BINS_ALL:%=%.html)
  69. HTMLS += Makefile.html
  70. HTMLS += gfx-fb.html
  71. HTMLS += gfx-x11.html
  72. HTMLS += gfx.html
  73. HTMLS += html.html
  74. HTMLS += png.html
  75. WEBROOT = /usr/local/www/causal.agency
  76. html: $(HTMLS)
  77. @true
  78. $(HTMLS): ttpre hi html.sh
  79. .SUFFIXES: .html
  80. .c.html:
  81. sh html.sh $< man1/$(<:.c=.1) > $@
  82. .sh.html:
  83. sh html.sh $< man1/$(<:.sh=.1) > $@
  84. .h.html:
  85. sh html.sh $< > $@
  86. Makefile.html: Makefile bin.7
  87. sh html.sh Makefile bin.7 > Makefile.html
  88. clean:
  89. rm -f $(BINS_ALL) $(LINKS) tags scheme.h scheme.png *.o *.html
  90. README: bin.7
  91. mandoc bin.7 | col -bx > README
  92. setuid: bri
  93. chown root bri
  94. chmod u+s bri
  95. link:
  96. install -d $(PREFIX)/bin $(MANDIR)/man1
  97. ln -fs $(BINS_ALL:%=$(PWD)/%) $(LINKS:%=$(PWD)/%) $(PREFIX)/bin
  98. ln -fs $(MAN1_ALL:%=$(PWD)/%) $(MANDIR)/man1
  99. unlink:
  100. rm -f $(BINS_ALL:%=$(PREFIX)/bin/%) $(LINKS:%=$(PREFIX)/bin/%)
  101. rm -f $(MAN1_ALL:%=$(MANDIR)/%)
  102. install-html: $(HTMLS)
  103. install -d $(WEBROOT)/bin
  104. install -C -m 644 $(HTMLS) $(WEBROOT)/bin