######################################################################### # # # Makefile for the C library libgpc.a with the GP_*.o files # # # # # # author: S. Zaleski # # # ######################################################################### # Define shell SHELL = /bin/sh # Change these lines for other machines: # Define compiler and flags FFLAGS = -g -fno-second-underscore # -mcmodel=medium FLAGS = -g -DLINUX FC = gfortran-mp-4.4 ifdef HAVE_MPI CC = openmpicc FC = openmpif90 RUN = mpirun -np 1 # double _ does not work on landau with MPI/f95 FFLAGS = -g -ffixed-line-length-132 # -funderscoring # -fno-second-underscore FLAGS = -g -DLINUX -DHAVE_MPI # `mpicc --showme:compile` # LDFLAGS = `mpicc --showme:link` MPI=MPI endif GPNAME = gpc$(MPI) # Name of library archiver and flags to send AR= ar ARFLAGS= r # Name of archive randomizer (use 'touch' if non-existent) RANLIB= ranlib # Location where to install the library libgpc.a # GPLIB = $(HOME)/lib/ GPINCDIR = $(HOME)/include/ # = 1 to have more information about tests. DEBUGTESTS = 1 HAVE_FORTRAN = 1 # ________________________________________________________________ # # Do not touch after this line INC = gp.h ifdef HAVE_MPI # double _ does not work on landau with MPI/f95 OBJF= GP_fortran.o # GP_fortran_.o else OBJF = GP_fortran.o endif ifdef HAVE_FORTRAN OBJECTS = $(OBJF) GP_read.o GP_simple.o GP_fetch.o else OBJECTS = GP_fetch.o GP_read.o GP_simple.o endif CFLAGS = $(FLAGS) -I$(GPINCDIR) -Wall -Wconversion # -mcmodel=medium ifdef HAVE_FORTRAN all: libgpc.a install test testf1 #CFLAGS= $(FLAGS) -DHASG2C -I$(GPINCDIR) -Wall -Wconversion # -mcmodel=medium else all: libgpc.a install test endif libgpc.a: gpi.h $(OBJECTS) $(AR) $(ARFLAGS) libgpc.a $(OBJECTS) install: libgpc.a if [ ! -d $(GPINCDIR) ] ; then mkdir $(GPINCDIR) ; fi -cp $(INC) $(GPINCDIR) if [ ! -d $(GPLIB) ] ; then mkdir $(GPLIB) ; fi -cp libgpc.a $(GPLIB)/lib$(GPNAME).a -$(RANLIB) $(GPLIB)/lib$(GPNAME).a @$(MAKE) message test: install test1 # test2 test3 test1: install gptest.c minflt.o par1.c cp par1.c parinclude.c $(CC) -DDEBUG=$(DEBUGTESTS) $(CFLAGS) -c gptest.c -o gptest.o $(CC) $(LDFLAGS) gptest.o minflt.o -o gptest -L$(GPLIB) -l$(GPNAME) $(RUN) ./gptest test1.par @$(MAKE) stdinmessage $(RUN) ./gptest < test1.par @$(MAKE) testmessage testf1: fgptest$(MPI).o minflt.o par1.f parinclude.f $(FC) fgptest$(MPI).o -o fgptest minflt.o -L$(GPLIB) -l$(GPNAME) $(RUN) ./fgptest test1f.par @$(MAKE) stdinmessage $(RUN) ./fgptest < test1f.par @$(MAKE) ftestmessage #Suffix rules .c.o: $(CC) -c $(CFLAGS) $< .f.o: parinclude.f $(FC) -c $(FFLAGS) $< parinclude.f: par1.f -cp par1.f parinclude.f # does not work with comments, so need to use different file par1.f: test1f.par awk -f awktosource test1f.par > par1.f clean: /bin/rm -f *.o *~ *# libgpc.a libgpcMPI.a core fgptest gptest if [ -d lib ] ; then /bin/rm -fr lib ; fi ifdef HAVE_FORTRAN message: @echo "" @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo " GP C library successfully created." @echo "" @echo " with Fortran modules" @echo "" @echo "User programs can be created as follows:" @echo "" @echo " cc program.c -I$(GPINCDIR) -L$(GPLIB) -l$(GPNAME) -o program" @echo "" @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo "" else message: @echo "" @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo " GP C library successfully created." @echo "" @echo " NO Fortran modules" @echo "" @echo "User programs can be created as follows:" @echo "" @echo " cc program.c -I$(GPINCDIR) -L$(GPLIB) -lgpc -o program" @echo "" @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo "" endif testmessage: @echo "" @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo " C TEST : PASS. CHECK THE RESULTS ABOVE FOR ERRORS " @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo "" ftestmessage: @echo "" @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo " Fortran TEST : PASS. CHECK THE RESULTS ABOVE FOR ERRORS !" @echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" @echo "" stdinmessage: @echo "***********************************************************" @echo " stdin test " @echo "***********************************************************"