Makefile 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. ######################################################################
  2. #
  3. # Based on the Makefile template from libMesh
  4. LIBMESH_DIR ?= /etc/libmesh
  5. # include the library options determined by configure
  6. include Make.common
  7. target := getpot_parse-$(METHOD)
  8. ###############################################################################
  9. # File management. This is where the source, header, and object files are
  10. # defined
  11. #
  12. # source files
  13. srcfiles := $(wildcard src/*.cpp)
  14. #
  15. # object files
  16. objects := $(patsubst src/%.cpp, build/%.$(obj-suffix), $(srcfiles))
  17. target_dir := bin
  18. inputs_dir := data
  19. REL_TARGET := $(target_dir)/$(target)
  20. BIN_RUN := OMPI_MCA_opal_warn_on_missing_libcuda=0 $(abspath $(REL_TARGET))
  21. BIN_OPTS := -igtp $(abspath $(getpot_fname)) $(output_mesh_fname)
  22. ###############################################################################
  23. .PHONY: clean_outputs clean_compile clean
  24. ###############################################################################
  25. # Target:
  26. #
  27. all:: $(notdir $(target))
  28. # Production rules: how to make the target - depends on library configuration
  29. $(REL_TARGET): $(objects)
  30. @echo "Linking "$@"..."
  31. @$(libmesh_LIBTOOL) \
  32. --tag=CXX $(LIBTOOLFLAGS) \
  33. --mode=link \
  34. $(libmesh_CXX) $(libmesh_CXXFLAGS) $(objects) \
  35. -o $@ \
  36. $(libmesh_LIBS) $(libmesh_LDFLAGS) $(EXTERNAL_FLAGS)
  37. # Useful rules.
  38. clean_outputs:
  39. @echo "Deleting old output and runtime files"
  40. @rm -f out*.m job_output.txt \
  41. output.txt* *.gmv.* *.plt.* out*.xdr* \
  42. out*.xda* PI* complete
  43. clean_compile:
  44. @echo "Deleting compiled libraries and objects"
  45. @rm -fr $(objects) build/*.o *.$(obj-suffix) *.lo .libs
  46. clean: clean_compile clean_outputs
  47. @echo "Deleting $(REL_TARGET)"
  48. @rm -f $(REL_TARGET) py2libmesh.tar.gz
  49. echo:
  50. @echo srcfiles = $(srcfiles)
  51. @echo objects = $(objects)
  52. @echo target = $(REL_TARGET)
  53. .PHONY: backup
  54. backup:
  55. tar czf py2libmesh.tar.gz $(wildcard data/*.msh) $(wildcard data/*.gtpt) $(wildcard include/*.h) $(srcfiles) Makefile Make.common
  56. run complete: $(wildcard *.in)
  57. @$(MAKE) $(REL_TARGET)
  58. @echo "***************************************************************"
  59. @echo "* Running App " $(notdir $(target))
  60. @echo "***************************************************************"
  61. @echo " "
  62. ifndef getpot_fname
  63. @echo "This Makefile only runs with an input filename (GetPot)"
  64. @echo "example: make run getpot_fname=data/inputs.gtpt"
  65. endif
  66. ifdef getpot_fname
  67. cd $(abspath $(inputs_dir)); \
  68. ${BIN_RUN} $(BIN_OPTS) 2>&1 | \
  69. tee output.txt && bzip2 -f output.txt
  70. endif
  71. @echo " "
  72. @echo "***************************************************************"
  73. @echo "* Done Running App " $(notdir $(target))
  74. @echo "***************************************************************"
  75. ###############################################################################