Makefile 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. SHELL=/bin/sh
  2. include config.mk
  3. BUILD=build
  4. PROG=src/ax
  5. MAN_IT=lang/it_IT/ax.1
  6. MAN=lang/en_EN/ax.1
  7. ETC=etc/client
  8. L_IT=lang/it_IT/ax
  9. .PHONY: all clean dist install uninstall
  10. all:
  11. $(CECHO)sed -i 's/^PREFIX=.*$$/PREFIX=\"$(subst /,\/,$(PREFIX))\"/g' $(PROG)
  12. $(CECHO)sed -i 's/^ETCPREFIX=.*$$/ETCPREFIX=\"$(subst /,\/,$(ETCPREFIX))\"/g' $(PROG)
  13. $(CECHO)sed -i "s/^\.I .*\/ax\/client$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/client/g" $(MAN)
  14. $(CECHO)sed -i "s/^\.I .*\/ax\/script.sh\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/script.sh/g" $(MAN)
  15. $(CECHO)sed -i "s/^\.I .*\/ax\/args.sh\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/args.sh/g" $(MAN)
  16. $(CECHO)sed -i "s/^\.I .*\/ax\/post.sh\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/post.sh/g" $(MAN)
  17. $(CECHO)sed -i "s/^\.I .*\/ax\/lang\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/lang/g" $(MAN)
  18. $(CECHO)sed -i "s/^\.I .*\/ax\/client$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/client/g" $(MAN_IT)
  19. $(CECHO)sed -i "s/^\.I .*\/ax\/script.sh\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/script.sh/g" $(MAN_IT)
  20. $(CECHO)sed -i "s/^\.I .*\/ax\/args.sh\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/args.sh/g" $(MAN_IT)
  21. $(CECHO)sed -i "s/^\.I .*\/ax\/post.sh\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/post.sh/g" $(MAN_IT)
  22. $(CECHO)sed -i "s/^\.I .*\/ax\/lang\$$/.I $(subst /,\/,$(ETCPREFIX))\/etc\/ax\/lang/g" $(MAN_IT)
  23. clean:
  24. @printf "Cleaning project\n"
  25. $(CECHO)rm -rf $(BUILD)/*
  26. dist: clean
  27. @printf "creating dist tarball\n"
  28. $(CECHO)mkdir -p ax-$(VERSION)/src/
  29. $(CECHO)mkdir -p ax-$(VERSION)/lang/it_IT/
  30. $(CECHO)mkdir -p ax-$(VERSION)/lang/en_EN/
  31. $(CECHO)mkdir -p ax-$(VERSION)/etc/
  32. $(CECHO)mkdir -p ax-$(VERSION)/$(BUILD)/
  33. $(CECHO)cp -R configure Makefile config.mk LICENSE README.md README_ita.md \
  34. USAGE.txt ax-$(VERSION)
  35. $(CECHO)cp -R $(PROG) ax-$(VERSION)/src/
  36. $(CECHO)cp -R $(L_IT) ax-$(VERSION)/lang/it_IT/
  37. $(CECHO)cp -R $(MAN) ax-$(VERSION)/lang/en_EN/
  38. $(CECHO)cp -R $(MAN_IT) ax-$(VERSION)/lang/it_IT/
  39. $(CECHO)cp -R $(ETC) ax-$(VERSION)/etc/
  40. $(CECHO)tar -cf ax-$(VERSION).tar ax-$(VERSION)
  41. $(CECHO)gzip ax-$(VERSION).tar
  42. $(CECHO)rm -rf ax-$(VERSION)
  43. $(CECHO)mv ax-$(VERSION).tar.gz $(BUILD)
  44. install: all
  45. @printf "installing shell file to $(PREFIX)/bin\n"
  46. $(CECHO)mkdir -p $(PREFIX)/bin
  47. $(CECHO)cp -f $(PROG) \
  48. $(PREFIX)/bin/$(subst src/,,$(PROG))
  49. $(CECHO)chmod 755 $(PREFIX)/bin/$(subst src/,,$(PROG))
  50. @printf "installing italian locale file to $(ETCPREFIX)/etc/ax\n"
  51. $(CECHO)mkdir -p $(ETCPREFIX)/etc/ax/lang/it_IT
  52. $(CECHO)cp -f $(L_IT) \
  53. $(ETCPREFIX)/etc/ax/$(L_IT)
  54. $(CECHO)chmod 755 $(ETCPREFIX)/etc/ax/$(L_IT)
  55. @printf "installing man file to $(MANPREFIX)/share/man/man1\n"
  56. $(CECHO)mkdir -p $(MANPREFIX)/share/man/man1
  57. $(CECHO)cp -f $(MAN) \
  58. $(MANPREFIX)/share/man/man1/$(subst lang/en_EN/,,$(MAN))
  59. $(CECHO)chmod 644 $(MANPREFIX)/share/man/man1/$(subst lang/en_EN/,,$(MAN))
  60. @printf "installing italian man file to $(MANPREFIX)/share/man/it/man1\n"
  61. $(CECHO)mkdir -p $(MANPREFIX)/share/man/it/man1
  62. $(CECHO)cp -f $(MAN_IT) \
  63. $(MANPREFIX)/share/man/it/man1/$(subst lang/it_IT/,,$(MAN_IT))
  64. $(CECHO)chmod 644 $(MANPREFIX)/share/man/it/man1/$(subst lang/it_IT/,,$(MAN_IT))
  65. @printf "installing config file to $(ETCPREFIX)/etc/ax\n"
  66. $(CECHO)mkdir -p $(ETCPREFIX)/etc/ax
  67. $(CECHO)cp -f $(ETC) \
  68. $(ETCPREFIX)/etc/ax/$(subst etc/,,$(ETC))
  69. $(CECHO)chmod 644 $(ETCPREFIX)/etc/ax/$(subst etc/,,$(ETC))
  70. uninstall:
  71. @printf "removing shell file from $(PREFIX)/bin\n"
  72. $(CECHO)rm -f $(PREFIX)/bin/$(subst src/,,$(PROG))
  73. @printf "removing italian locale file from $(ETCPREFIX)/etc/ax\n"
  74. $(CECHO)rm -f $(ETCPREFIX)/etc/ax/$(L_IT)
  75. @printf "removing man file from $(MANPREFIX)/share/man/man1\n"
  76. $(CECHO)rm -f $(MANPREFIX)/share/man/man1/$(subst lang/en_EN/,,$(MAN))
  77. @printf "removing italian man file from $(MANPREFIX)/share/man/it/man1\n"
  78. $(CECHO)rm -f $(MANPREFIX)/share/man/it/man1/$(subst lang/it_IT/,,$(MAN_IT))
  79. @printf "removing config file from $(ETCPREFIX)/etc/ax\n"
  80. $(CECHO)rm -f $(ETCPREFIX)/etc/ax/$(subst etc/,,$(ETC))