Makefile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # dwm - dynamic window manager
  2. # See LICENSE file for copyright and license details.
  3. include config.mk
  4. SRC = src/drw.c src/archy_dwm.c src/util.c
  5. OBJ_DIR = build
  6. OBJ = ${SRC:%.c=$(OBJ_DIR)/%.o}
  7. BUILD_DIR = ${OBJ_DIR}/archy-dwm
  8. all: options ${BUILD_DIR}
  9. options:
  10. @echo archy-dwm build options:
  11. @echo "CFLAGS = ${CFLAGS}"
  12. @echo "LDFLAGS = ${LDFLAGS}"
  13. @echo "CC = ${CC}"
  14. ${OBJ_DIR}/%.o: %.c
  15. mkdir -p $(@D)
  16. ${CC} -c ${CFLAGS} $< -o $@
  17. ${OBJ}: src/config/config.h config.mk
  18. config.h:
  19. cp config.def.h $@
  20. ${BUILD_DIR}: ${OBJ}
  21. ${CC} -o $@ ${OBJ} ${LDFLAGS}
  22. clean:
  23. rm -rf ${OBJ_DIR}
  24. dist: ${BUILD_DIR} archy-dwm.desktop
  25. mkdir -p archy-dwm_${VERSION}
  26. cp -R LICENSE README.md ${BUILD_DIR} ${OBJ_DIR}/archy-dwm.desktop archy-dwm.1 dwm.png archy-dwm_${VERSION}
  27. tar -cf archy-dwm_${VERSION}.tar archy-dwm_${VERSION}
  28. gzip archy-dwm_${VERSION}.tar
  29. rm -rf archy-dwm_${VERSION}
  30. mkdir -p dist
  31. mv archy-dwm_${VERSION}.tar.gz dist
  32. echo "The tarball is ready."
  33. printf "Tarball size: %s\n" $$(du -h dist/archy-dwm_${VERSION}.tar.gz | cut -f1)
  34. printf "Tarball hash: %s\n" $$(sha256sum dist/archy-dwm_${VERSION}.tar.gz)
  35. install: all
  36. mkdir -p ${DESTDIR}${PREFIX}/bin
  37. cp -f ${BUILD_DIR} ${DESTDIR}${PREFIX}/bin
  38. chmod 755 ${DESTDIR}${PREFIX}/bin/archy-dwm
  39. mkdir -p ${DESTDIR}${MANPREFIX}/man1
  40. sed "s/VERSION/${VERSION}/g" < archy-dwm.1 > ${DESTDIR}${MANPREFIX}/man1/archy-dwm.1
  41. chmod 644 ${DESTDIR}${MANPREFIX}/man1/archy-dwm.1
  42. archy-dwm.desktop:
  43. mkdir -p "$(OBJ_DIR)"
  44. echo "[Desktop Entry]" > "$(OBJ_DIR)/archy-dwm.desktop"
  45. echo "Type=XSession" >> "$(OBJ_DIR)/archy-dwm.desktop"
  46. echo "Exec=$(DESTDIR)$(PREFIX)/bin/archy-dwm" >> "$(OBJ_DIR)/archy-dwm.desktop"
  47. echo "DesktopNames=archy-dwm" >> "$(OBJ_DIR)/archy-dwm.desktop"
  48. echo "Name=archy-dwm" >> "$(OBJ_DIR)/archy-dwm.desktop"
  49. echo "Comment=\"A dynamic window manager for X\"" >> "$(OBJ_DIR)/archy-dwm.desktop"
  50. desktop: archy-dwm.desktop
  51. mkdir -p ${DESTDIR}${PREFIX}/share/xsessions
  52. cp "$(OBJ_DIR)/archy-dwm.desktop" ${DESTDIR}${PREFIX}/share/xsessions/archy-dwm.desktop
  53. uninstall:
  54. rm -f ${DESTDIR}${PREFIX}/bin/archy-dwm \
  55. ${DESTDIR}${MANPREFIX}/man1/archy-dwm.1 \
  56. ${DESTDIR}${PREFIX}/share/xsessions/archy-dwm.desktop
  57. .PHONY: all options clean dist install uninstall