Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. SHELL = /bin/sh
  2. ###############################
  3. include ../Makefile.conf
  4. VPATH=$(SRCDIR)/mpi-serial
  5. # SOURCE FILES
  6. MODULE = mpi-serial
  7. SRCS_F90 = fort.F90
  8. SRCS_C = mpi.c \
  9. send.c \
  10. recv.c \
  11. collective.c \
  12. req.c \
  13. list.c \
  14. handles.c \
  15. comm.c \
  16. group.c \
  17. time.c \
  18. pack.c
  19. OBJS_ALL = $(SRCS_C:.c=.o) \
  20. $(SRCS_F90:.F90=.o)
  21. INCPATH:= $(INCFLAG)$(SRCDIR)/mpi-serial $(INCFLAG). $(INCFLAG)../ $(INCPATH)
  22. #
  23. # The values used from Makefile.conf
  24. #
  25. # ALLCFLAGS= -DFORTRAN_UNDERSCORE_
  26. # ALLCFLAGS= -DFORTRAN_SAME
  27. # ALLCFLAGS= -DFORTRAN_CAPS
  28. # FC=pgf90
  29. # AR=ar rv
  30. # CC=cc
  31. ###############################
  32. # TARGETS
  33. default: lib$(MODULE).a
  34. examples: ctest ftest
  35. MPIFH= mpif.$(FORT_SIZE).h
  36. mpif.h: $(MPIFH)
  37. cp -f $< $@
  38. fort.o: mpif.h
  39. lib:
  40. @if [ ! "$(FORT_SIZE)" ] ; \
  41. then echo "Please set FORT_SIZE (e.g. real4double8 or real8double16) when you do the main MCT configure"; \
  42. exit 1; fi
  43. @if [ ! -r $(MPIFH) ] ; \
  44. then echo "Error: there is no $(MPIFH) -" \
  45. "check the value of FORT_SIZE in the main MCT configure" ; \
  46. exit 1; fi
  47. cp -f $(MPIFH) mpif.h
  48. chmod -w mpif.h
  49. $(MAKE) $(LIB)
  50. lib$(MODULE).a: $(OBJS_ALL)
  51. echo $(OBJS_ALL)
  52. $(RM) $@
  53. $(AR) $@ $(OBJS_ALL)
  54. LIB = lib$(MODULE).a
  55. ###############################
  56. #RULES
  57. .SUFFIXES:
  58. .SUFFIXES: .F90 .c .o
  59. .c.o:
  60. $(CC) -c $(INCPATH) $(CFLAGS) $<
  61. .F90.o:
  62. $(FC) -c $(INCFLAG). $(INCPATH) $(FPPDEFS) $(FCFLAGS) $(MPEUFLAGS) $<
  63. MYF90FLAGS=$(INCPATH) $(DEFS) $(FCFLAGS) $(MPEUFLAGS)
  64. clean:
  65. /bin/rm -f *.o ctest ftest $(LIB) mpif.h
  66. install: lib
  67. $(MKINSTALLDIRS) $(libdir) $(includedir)
  68. $(INSTALL) lib$(MODULE).a -m 644 $(libdir)
  69. $(INSTALL) mpi.h -m 644 $(includedir)
  70. $(INSTALL) mpif.h -m 644 $(includedir)
  71. ###############################
  72. #
  73. # Create mpif.realXdoubleY.h filesfrom mpif.master.h template
  74. #
  75. mpif:
  76. make-mpif 4 8
  77. make-mpif 8 8
  78. make-mpif 8 16
  79. ###############################
  80. #
  81. # test programs
  82. #
  83. ctest: lib ctest.c
  84. $(CC) $(ALLCFLAGS) -o $@ ctest.c -L. -lmpi-serial
  85. ftest: lib ftest.F90
  86. $(FC) $(MYF90FLAGS) -o $@ ftest.F90 -L. -lmpi-serial