Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #! /usr/bin/make -f
  2. # Destinations compliant with Filesystem Hierarchy Standard (FHS) 2.1
  3. # DESTDIR prefix required by Debian build process
  4. CONFDIR=$(DESTDIR)/etc
  5. PROGDIR=$(DESTDIR)/usr/bin
  6. INSTDIR=$(DESTDIR)/usr/share/mtt
  7. # DOCPATH and INFOPATH required by doc/Makefile
  8. DOCDIR=$(DESTDIR)/usr/share/doc/mtt
  9. INFODIR=$(DESTDIR)/usr/share/info
  10. # XFIG Libraries directory
  11. XFIGDIR=$(DESTDIR)/usr/share/xfig/Libraries
  12. configure: configure-stamp
  13. configure-stamp:
  14. @touch configure-stamp
  15. build: configure mtt.sh xmtt.sh build-stamp
  16. build-cc:
  17. @cd cc ; make -s build
  18. build-doc:
  19. @cd doc ; make -s all
  20. build-stamp:
  21. @touch build-stamp
  22. clean:
  23. @touch clean.sh
  24. @-chmod a+x clean.sh
  25. @./clean.sh
  26. @rm -f clean.sh
  27. clean-cc:
  28. @touch clean-cc.sh
  29. @-chmod a+x clean-cc.sh
  30. @./clean-cc.sh
  31. @rm -f clean-cc.sh
  32. clean-conf:
  33. @touch clean-conf.sh
  34. @-chmod a+x clean-conf.sh
  35. @./clean-conf.sh
  36. @rm -f clean-conf.sh
  37. clean-doc:
  38. @touch clean-doc.sh
  39. @-chmod a+x clean-doc.sh
  40. @./clean-doc.sh
  41. @rm -f clean-doc.sh
  42. @cd doc ; make -s clean
  43. clean-xfig:
  44. @touch clean-xfig.sh
  45. @-chmod a+x clean-xfig.sh
  46. @./clean-xfig.sh
  47. @rm -f clean-xfig.sh
  48. distclean: clean clean-cc clean-conf clean-doc clean-xfig
  49. @-rm -f build-stamp configure-stamp config.log mtt.sh xmtt.sh
  50. install: build clean.sh clean-conf.sh
  51. @install -d $(INSTDIR) $(CONFDIR) $(PROGDIR)
  52. @cp -a bin cc doc lib $(INSTDIR)
  53. @cat bin/mttrc | grep -v 'MTT_LIB/xfig' |\
  54. sed 's|$$1|/usr/share/mtt|' > $(CONFDIR)/mtt.conf
  55. @install mtt.sh $(PROGDIR)/mtt
  56. @install xmtt.sh $(PROGDIR)/xmtt
  57. install-cc: build-cc clean-cc.sh
  58. @install -d $(INSTDIR)/bin/trans
  59. @install cc/parse_m2cc.exe $(INSTDIR)/bin/trans
  60. install-doc: build-doc clean-doc.sh
  61. @install -d $(DOCDIR) $(INFODIR)
  62. @cd doc ; DOCPATH=$(DOCDIR) INFOPATH=$(INFODIR) make -s install-doc
  63. @cd doc ; install Makefile mtt.info* mtt.pdf mtt.ps.gz $(DOCDIR)
  64. @install doc/mtt.info* $(INFODIR)
  65. install-xfig: clean-xfig.sh
  66. @install -d $(XFIGDIR)
  67. @cp -a lib/xfig $(XFIGDIR)/MTT_Bond_Graph
  68. .PHONY: FORCE
  69. clean.sh: FORCE
  70. @echo '#! /bin/sh' >>clean.sh
  71. @echo '# This file is auto-generated - do not edit' >>clean.sh
  72. @echo 'rm -f $(PROGDIR)/mtt $(PROGDIR)/xmtt' >>clean.sh
  73. @echo 'rm -fr $(INSTDIR)' >>clean.sh
  74. clean-cc.sh: FORCE
  75. @echo '#! /bin/sh' >>clean-cc.sh
  76. @echo '# This file is auto-generated - do not edit' >>clean-cc.sh
  77. @echo 'rm -f $(INSTDIR)/bin/trans/parse_m2cc.exe' >>clean-cc.sh
  78. clean-conf.sh: FORCE
  79. @echo '#! /bin/sh' >>clean-conf.sh
  80. @echo '# This file is auto-generated - do not edit' >>clean-conf.sh
  81. @echo 'rm -f $(CONFDIR)/mtt.conf' >>clean-conf.sh
  82. clean-doc.sh: FORCE
  83. @echo '#! /bin/sh' >>clean-doc.sh
  84. @echo '# This file is auto-generated - do not edit' >>clean-doc.sh
  85. @echo 'rm -fr $(DOCDIR)' >>clean-doc.sh
  86. @echo 'rm -f $(INFODIR)/mtt.info*' >>clean-doc.sh
  87. clean-xfig.sh: FORCE
  88. @echo '#! /bin/sh' >>clean-xfig.sh
  89. @echo '# This file is auto-generated - do not edit' >>clean-xfig.sh
  90. @echo 'rm -f $(XFIGDIR)/MTT_Bond_Graph' >>clean-xfig.sh
  91. mtt.sh.tmp:
  92. @echo '#! /bin/sh' > mtt.sh.tmp
  93. @echo '# This file is auto-generated - do not edit' >>mtt.sh.tmp
  94. @echo '' >>mtt.sh.tmp
  95. @echo 'mtt_config_file=$(CONFDIR)/mtt.conf' >>mtt.sh.tmp
  96. @echo 'mtt_program_dir=$(PROGDIR)' >>mtt.sh.tmp
  97. @echo 'mtt_install_dir=$(INSTDIR)' >>mtt.sh.tmp
  98. @echo '' >>mtt.sh.tmp
  99. @echo '# get site-specific settings' >>mtt.sh.tmp
  100. @echo 'if [ -r $${mtt_config_file} ]; then' >>mtt.sh.tmp
  101. @echo ' . $${mtt_config_file} $${mtt_install_dir} >/dev/null' >>mtt.sh.tmp
  102. @echo '' >>mtt.sh.tmp
  103. @echo 'elif [ -r $${mtt_install_dir}/bin/mttrc ]; then' >>mtt.sh.tmp
  104. @echo ' . $${mtt_install_dir}/bin/mttrc $${mtt_install_dir}' >>mtt.sh.tmp
  105. @echo 'fi' >>mtt.sh.tmp
  106. @echo '' >>mtt.sh.tmp
  107. @echo '# get user-specific settings' >>mtt.sh.tmp
  108. @echo 'if [ -r $${HOME}/.mttrc ]; then' >>mtt.sh.tmp
  109. @echo ' . $${HOME}/.mttrc' >>mtt.sh.tmp
  110. @echo 'fi' >>mtt.sh.tmp
  111. @echo '' >>mtt.sh.tmp
  112. @echo '# get directory-specific settings' >>mtt.sh.tmp
  113. @echo 'if [ -r ./.mttrc ]; then' >>mtt.sh.tmp
  114. @echo ' . ./.mttrc' >>mtt.sh.tmp
  115. @echo 'fi' >>mtt.sh.tmp
  116. @echo '' >>mtt.sh.tmp
  117. mtt.sh: mtt.sh.tmp
  118. @cat mtt.sh.tmp bin/mtt > mtt.sh
  119. xmtt.sh: mtt.sh.tmp
  120. @cat mtt.sh.tmp bin/xmtt > xmtt.sh