Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Create a makefile

felipin85
Beginner
2,091 Views
Hi everybody!
I would like create a makefile to solve a big problems (using Lapack 95 and mkl_dss). The main programwill haveseveraldependent files(subroutines).
For example the main program is hola.f90, the subroutine dependent is escribir.f90. I write a makefile, but I get the following message:
felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make
make: *** No hay ninguna regla para construir el objetivo ESCRIBIR.o, necesario para hola. Alto.

If, I translate to English for you:

make: *** Don't exist any rule to build the objetive <>, necesary for <>. Stop

Please, I would like create the makefile, that If I change something in Escribir.f90 or hola.f90, these are update.That is,the filesarecompiledand linking.

If they can nothelp meorgoes outsidethescope oftheforum,Iwould like toknowwhereto finddocumentation.

Thanks for your help,
Felipe
0 Kudos
1 Solution
mecej4
Honored Contributor III
2,091 Views
I do not know what you have in the modified makefile, so here is a simplified makefile that produces the correct commands.

[bash]FC= ifort
.SUFFIXES: .f90 .o

OBJS= hola.o escribir.o
FFLAGS= -openmp -O3
MKLINCLUDE=/opt/intel/composerxe-2011/include/ia32
MKLPATH=/opt/intel/composerxe-2011.0.084/mkl/lib/ia32/
hola: $(OBJS)
	$(FC) $(FFLAGS) -o  hola $(OBJS) -L$(MKLPATH) -lmkl_lapack95 -Wl,--start-group $(MKLPATH)/libmkl_intel.a $(MKLPATH)/libmkl_intel_thread.a $(MKLPATH)/libmkl_core.a -Wl,--end-group -liomp5 -lpthread
.f90.o:
	$(FC) $(FFLAGS) -c $< -I$(MKLINCLUDE)
clean:
	rm hola $(OBJS)
[/bash]

Note that I have removed linker options from the .f90.o rule.

View solution in original post

0 Kudos
4 Replies
mecej4
Honored Contributor III
2,091 Views
Make is telling you that it does not have a built-in rule to make .o files from .f90 files.

Your makefile already has lines for a ".f90 .o" rule, but those lines are prefixed by '#' in column-1. Simply removing the #s will take you to the next step.
0 Kudos
felipin85
Beginner
2,091 Views


I'm changed the makefile, but I have the same problem:

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make

make: *** No hay ninguna regla para construir el objetivo hola.o, necesario para hola. Alto.

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make hola

make: *** No hay ninguna regla para construir el objetivo hola.o, necesario para hola. Alto.

I created a new makefile, this works better than the other, but I have any problem, for example:

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make

make: *** No hay ninguna regla para construir el objetivo hola.o, necesario para hola. Alto.

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make hola

make: *** No hay ninguna regla para construir el objetivo hola.o, necesario para hola. Alto.

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make

make: *** No hay ninguna regla para construir el objetivo hola.o, necesario para hola. Alto.

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make todo

make: *** No hay ninguna regla para construir el objetivo hola.o, necesario para hola. Alto.

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make hola

make: *** No hay ninguna regla para construir el objetivo hola.o, necesario para hola. Alto.

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make compilar

ifort -openmp -O3 -c hola.f90 escribir.f90 -I/opt/intel/composerxe-2011/include/ia32 -L/opt/intel/composerxe-2011.0.084/mkl/lib/ia32 -lmkl_lapack95 -Wl,--start-group /opt/intel/composerxe-2011.0.084/mkl/lib/ia32/libmkl_intel.a /opt/intel/composerxe-2011.0.084/mkl/lib/ia32/libmkl_intel_thread.a /opt/intel/composerxe-2011.0.084/mkl/lib/ia32/libmkl_core.a -Wl,--end-group -liomp5 -lpthread

ifort: error #10104: unable to open '--end-group'

make: *** [compilar] Error 1

felipe@felipe-desktop:~/Escritorio/mis pruebas make$ make hola

ifort -openmp -O3 -o hola hola.o escribir.o -I/opt/intel/composerxe-2011/include/ia32 -L/opt/intel/composerxe-2011.0.084/mkl/lib/ia32 -lmkl_lapack95 -Wl,--start-group /opt/intel/composerxe-2011.0.084/mkl/lib/ia32/libmkl_intel.a /opt/intel/composerxe-2011.0.084/mkl/lib/ia32/libmkl_intel_thread.a /opt/intel/composerxe-2011.0.084/mkl/lib/ia32/libmkl_core.a -Wl,--end-group -liomp5 -lpthread

But, althoughthere areerrors,thefinalwork.Iwish I coulddoalonemake,andeverythingis built.I guessit'sasimple commandthat I have not.


Theedited file works is Makefile, and the first file changed (clean the coments #) is Makefile1.


Thanks for your help,
Felipe
0 Kudos
mecej4
Honored Contributor III
2,092 Views
I do not know what you have in the modified makefile, so here is a simplified makefile that produces the correct commands.

[bash]FC= ifort
.SUFFIXES: .f90 .o

OBJS= hola.o escribir.o
FFLAGS= -openmp -O3
MKLINCLUDE=/opt/intel/composerxe-2011/include/ia32
MKLPATH=/opt/intel/composerxe-2011.0.084/mkl/lib/ia32/
hola: $(OBJS)
	$(FC) $(FFLAGS) -o  hola $(OBJS) -L$(MKLPATH) -lmkl_lapack95 -Wl,--start-group $(MKLPATH)/libmkl_intel.a $(MKLPATH)/libmkl_intel_thread.a $(MKLPATH)/libmkl_core.a -Wl,--end-group -liomp5 -lpthread
.f90.o:
	$(FC) $(FFLAGS) -c $< -I$(MKLINCLUDE)
clean:
	rm hola $(OBJS)
[/bash]

Note that I have removed linker options from the .f90.o rule.
0 Kudos
felipin85
Beginner
2,091 Views
mecej4,
It's ok. Very thanks for your help, you are the best.
Regards,
Thanks
0 Kudos
Reply