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.

164 lines
2.8KB

  1. PREFIX = ~/.local
  2. MANDIR = ${PREFIX}/share/man
  3. CFLAGS += -Wall -Wextra -Wpedantic -Wno-gnu-case-range
  4. LDLIBS = -lm -lutil -lz
  5. CURL_PREFIX = /usr/local
  6. CFLAGS_curl = ${CFLAGS} -I${CURL_PREFIX}/include
  7. LDFLAGS_curl = ${LDFLAGS} -L${CURL_PREFIX}/lib
  8. LDLIBS_curl = ${LDLIBS} -lcurl
  9. LIBRESSL_PREFIX = /usr/local
  10. CFLAGS_tls = ${CFLAGS} -I${LIBRESSL_PREFIX}/include
  11. LDFLAGS_tls = ${LDFLAGS} -L${LIBRESSL_PREFIX}/lib
  12. LDLIBS_tls = ${LDLIBS} -ltls
  13. -include config.mk
  14. BINS_ANY += aes
  15. BINS_ANY += beef
  16. BINS_ANY += bit
  17. BINS_ANY += dtch
  18. BINS_ANY += edit
  19. BINS_ANY += glitch
  20. BINS_ANY += hi
  21. BINS_ANY += hnel
  22. BINS_ANY += modem
  23. BINS_ANY += order
  24. BINS_ANY += pbd
  25. BINS_ANY += pngo
  26. BINS_ANY += psf2png
  27. BINS_ANY += ptee
  28. BINS_ANY += scheme
  29. BINS_ANY += setopt
  30. BINS_ANY += shotty
  31. BINS_ANY += ttpre
  32. BINS_ANY += up
  33. BINS_ANY += when
  34. BINS_ANY += xx
  35. LINKS_ANY += open
  36. LINKS_ANY += pbcopy
  37. LINKS_ANY += pbpaste
  38. BINS_BSD += ever
  39. BINS_LINUX += bri
  40. BINS_LINUX += fbatt
  41. BINS_LINUX += fbclock
  42. BINS_LINUX += psfed
  43. BINS_CURL += title
  44. BINS_TLS += relay
  45. BINS = ${BINS_ANY} ${BINS_BSD} ${BINS_LINUX} ${BINS_CURL} ${BINS_TLS}
  46. MANS = ${BINS:%=man1/%.1}
  47. LINKS = ${LINKS_ANY}
  48. # Groups
  49. any: meta ${BINS_ANY} ${LINKS_ANY}
  50. bsd: meta ${BINS_BSD}
  51. linux: meta ${BINS_LINUX}
  52. curl: meta ${BINS_CURL}
  53. tls: meta ${BINS_TLS}
  54. meta: tags .gitignore
  55. # Binaries
  56. hi: hi.c
  57. ${CC} ${CFLAGS} ${LDFLAGS} hi.c ${LDLIBS} -o $@
  58. ./hi -c
  59. open pbcopy pbpaste: pbd
  60. ln -f pbd $@
  61. relay: relay.c
  62. ${CC} ${CFLAGS_tls} ${LDFLAGS_tls} $@.c ${LDLIBS_tls} -o $@
  63. title: title.c
  64. ${CC} ${CFLAGS_curl} ${LDFLAGS_curl} $@.c ${LDLIBS_curl} -o $@
  65. # Headers
  66. fbatt.o fbclock.o: scheme.h
  67. psf2png.o scheme.o: png.h
  68. scheme.h: scheme
  69. ./scheme -c > scheme.h
  70. .o:
  71. ${CC} ${LDFLAGS} $< ${LDLIBS} -o $@
  72. # HTML
  73. HTMLS = index.html ${BINS:%=%.html} png.html
  74. WEBROOT = /usr/local/www/causal.agency
  75. html: ${HTMLS}
  76. @true
  77. ${HTMLS}: html.sh hi ttpre
  78. .SUFFIXES: .html
  79. .c.html:
  80. sh html.sh $< man1/${<:.c=.1} > $@
  81. .h.html:
  82. sh html.sh $< man3/${<:.h=.3} > $@
  83. .sh.html:
  84. sh html.sh $< man1/${<:.sh=.1} > $@
  85. .y.html:
  86. sh html.sh $< man1/${<:.y=.1} > $@
  87. index.html: Makefile README.7
  88. sh html.sh Makefile README.7 \
  89. | sed -E 's,([a-z0-9-]+)[(][1-9][)],<a href="\1.html">&</a>,' \
  90. > index.html
  91. # Meta
  92. scheme.png: scheme
  93. ./scheme -gt > scheme.png
  94. tags: *.h *.c
  95. ctags -w *.h *.c
  96. IGNORE = '*.o' '*.html' scheme.h scheme.png tags ${BINS} ${LINKS}
  97. .gitignore: Makefile
  98. echo config.mk ${IGNORE} | tr ' ' '\n' | sort > .gitignore
  99. clean:
  100. rm -f ${IGNORE}
  101. # Install
  102. link:
  103. install -d ${PREFIX}/bin ${MANDIR}/man1
  104. ln -fs ${BINS:%=${PWD}/%} ${LINKS:%=${PWD}/%} ${PREFIX}/bin
  105. ln -fs ${MANS:%=${PWD}/%} ${MANDIR}/man1
  106. unlink:
  107. rm -f ${BINS:%=${PREFIX}/bin/%} ${LINKS:%=${PREFIX}/bin/%}
  108. rm -f ${MANS:%=${MANDIR}/%}
  109. install-html: ${HTMLS}
  110. install -d ${WEBROOT}/bin
  111. install -C -m 644 ${HTMLS} ${WEBROOT}/bin
  112. setuid: bri
  113. chown root bri
  114. chmod u+s bri