Commits

Christos Kannas committed 6da0dd9

Update: Makefile to compile C and FORTRAN.

Comments (0)

Files changed (1)

 # Set here the desired C compiler and its optimization options
-CC   = nvcc
+NVCC   = nvcc
 COPT = -O -Wall  
 
+# Set here the Fortran77 compiler and the desired optimization options
+COMPILER = GNU
+
+FC_INTEL   = ifort
+FOPT_INTEL = -O -f77rtl -mp -pc80 -prec_div -tpp7
+FC_PGF     = pgf77
+FOPT_PGF   = -O -fast -pc 80 -Kieee
+FC_GNU     = g77
+FOPT_GNU   = -O -Wall -Wimplicit -ffast-math -funroll-loops \
+	         -malign-double -ffortran-bounds-check
+FC_HPUX    = f90
+FOPT_HPUX  = -O
+
+FC   = $(FC_$(COMPILER))
+FOPT = $(FOPT_$(COMPILER)) 
+
 # To create Matlab gateway routines
-# Note: use $(CC) as the mex C compiler
+# Note: use $(NVCC) as the mex C compiler
 MEX  = mex
 
 HEADERS = KPP_ROOT_Global.h  KPP_ROOT_Parameters.h  KPP_ROOT_Sparse.h  KPP_ROOT_CUDA_Utils.h
     KPP_ROOT_Stoichiom.c KPP_ROOT_Util.c         \
     KPP_ROOT_Monitor.c
 
+FSRC = KPP_ROOT_Integrator.f90
+
 OBJ =   KPP_ROOT_Main.o      KPP_ROOT_Integrator.o   \
     KPP_ROOT_Function.o  KPP_ROOT_Initialize.o   \
     KPP_ROOT_Jacobian.o  KPP_ROOT_LinearAlgebra.o\
     KPP_ROOT_Stoichiom.o KPP_ROOT_Util.o         \
     KPP_ROOT_Monitor.o
 
+FOBJ = KPP_ROOT_Integrator_f90.o
+
 STOCHSRC = KPP_ROOT_Stochastic.c 
 STOCHOBJ = KPP_ROOT_Stochastic.o 
 
 all:    exe
 
 exe:    $(HEADERS) $(SPOBJ) $(OBJ)
-    $(CC) $(COPT) $(SPOBJ) $(OBJ) -lm -o KPP_ROOT.exe    
+    $(NVCC) $(COPT) $(SPOBJ) $(OBJ) -lm -o KPP_ROOT.exe    
 
 stochastic:$(HEADERS) $(SPOBJ) $(OBJ) $(STOCHOBJ)
-    $(CC) $(COPT) $(SPOBJ) $(OBJ) $(STOCHOBJ) -lm \
+    $(NVCC) $(COPT) $(SPOBJ) $(OBJ) $(STOCHOBJ) -lm \
     -o KPP_ROOT_stochastic.exe    
 
 mex:    $(HEADERS) $(SPOBJ) $(OBJ)
-    $(MEX) CC#$(CC) -O KPP_ROOT_mex_Fun.c     -lm $(SPOBJ) $(OBJ)
-    $(MEX) CC#$(CC) -O KPP_ROOT_mex_Jac_SP.c  -lm $(SPOBJ) $(OBJ)
-    $(MEX) CC#$(CC) -O KPP_ROOT_mex_Hessian.c -lm $(SPOBJ) $(OBJ)
+    $(MEX) NVCC#$(NVCC) -O KPP_ROOT_mex_Fun.c     -lm $(SPOBJ) $(OBJ)
+    $(MEX) NVCC#$(NVCC) -O KPP_ROOT_mex_Jac_SP.c  -lm $(SPOBJ) $(OBJ)
+    $(MEX) NVCC#$(NVCC) -O KPP_ROOT_mex_Hessian.c -lm $(SPOBJ) $(OBJ)
 
 
 clean:
-    rm -f $(SPOBJ) $(OBJ) KPP_ROOT.exe KPP_ROOT_*.mexglx KPP_ROOT*.dat
+    rm -f $(SPOBJ) $(OBJ) $(FOBJ) KPP_ROOT.exe KPP_ROOT_*.mexglx KPP_ROOT*.dat
 
 distclean:
-    rm -f $(SPOBJ) $(OBJ) KPP_ROOT.exe KPP_ROOT*.dat \
-    KPP_ROOT_*.c KPP_ROOT_*.cu KPP_ROOT_*.h KPP_ROOT_*.map KPP_ROOT_*.mexglx
+    rm -f $(SPOBJ) $(OBJ) $(FOBJ) KPP_ROOT.exe KPP_ROOT*.dat \
+    KPP_ROOT_*.c KPP_ROOT_*.cu KPP_ROOT_*.h KPP_ROOT_*.f90 KPP_ROOT_*.map KPP_ROOT_*.mexglx
 
 KPP_ROOT_Monitor.o: KPP_ROOT_Monitor.c $(HEADERS)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_JacobianSP.o: KPP_ROOT_JacobianSP.c $(HEADERS)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_HessianSP.o: KPP_ROOT_HessianSP.c  $(HEADERS)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_StoichiomSP.o: KPP_ROOT_StoichiomSP.c $(HEADERS)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Main.o: KPP_ROOT_Main.c KPP_ROOT_Initialize.o $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Integrator.o: KPP_ROOT_Integrator.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
+
+KPP_ROOT_Integrator_f90.o: KPP_ROOT_Integrator.f90 $(FC) $(FOPT) -c $<
 
 KPP_ROOT_Initialize.o: KPP_ROOT_Initialize.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Function.o: KPP_ROOT_Function.cu  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Stochastic.o: KPP_ROOT_Stochastic.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Jacobian.o: KPP_ROOT_Jacobian.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_LinearAlgebra.o: KPP_ROOT_LinearAlgebra.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Rates.o: KPP_ROOT_Rates.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Hessian.o:  KPP_ROOT_Hessian.c $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Stoichiom.o: KPP_ROOT_Stoichiom.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<
 
 KPP_ROOT_Util.o: KPP_ROOT_Util.c  $(HEADERS) $(SPOBJ)
-    $(CC) $(COPT) -c $<
+    $(NVCC) $(COPT) -c $<