22# This is the makefile to create a library for LAPACK.
33# The files are organized as follows:
44
5+ # ALLMOD -- Part of ALLAUX
56# ALLAUX -- Auxiliary routines called from all precisions
67# SCLAUX -- Auxiliary routines called from single precision
78# DZLAUX -- Auxiliary routines called from double precision
3536#
3637#######################################################################
3738
39+ set (ALLMOD la_xisnan.F90 la_constants.f90)
40+
3841set (ALLAUX ilaenv.f ilaenv2stage.f ieeeck.f lsamen.f iparmq.f iparam2stage.F
39- ilaprec.f ilatrans.f ilauplo.f iladiag.f chla_transtype.f la_xisnan.F90
42+ ilaprec.f ilatrans.f ilauplo.f iladiag.f chla_transtype.f
4043 ../INSTALL /ilaver.f ../INSTALL /lsame.f xerbla.f xerbla_array.f
4144 ../INSTALL /slamch.f)
4245
4346set (SCLAUX
44- la_constants.f90
4547 sbdsvdx.f sbdsdc.f
4648 sbdsqr.f sdisna.f slabad.f slacpy.f sladiv.f slae2.f slaebz.f
4749 slaed0.f slaed1.f slaed2.f slaed3.f slaed4.f slaed5.f slaed6.f
@@ -60,7 +62,6 @@ set(SCLAUX
6062 ${SECOND_SRC} )
6163
6264set (DZLAUX
63- la_constants.f90
6465 dbdsdc.f dbdsvdx.f
6566 dbdsqr.f ddisna.f
6667 disnan.f
@@ -514,7 +515,17 @@ if(BUILD_COMPLEX16)
514515endif ()
515516list (REMOVE_DUPLICATES SOURCES )
516517
518+ # Use special target for MOD files to guarantee they are built before
519+ # any other files that depend on them
520+ add_library (mod_files OBJECT ${ALLMOD} )
521+ set_target_properties (
522+ mod_files PROPERTIES
523+ POSITION_INDEPENDENT_CODE ON
524+ Fortran_PREPROCESS ON
525+ )
526+
517527add_library (${LAPACKLIB} _obj OBJECT ${SOURCES} )
528+ target_link_libraries (${LAPACKLIB} _obj mod_files)
518529set_target_properties (
519530 ${LAPACKLIB} _obj PROPERTIES
520531 POSITION_INDEPENDENT_CODE ON
@@ -527,6 +538,7 @@ if(BUILD_INDEX64_EXT_API)
527538 list (REMOVE_ITEM SOURCES_64 ${SECOND_SRC} )
528539 list (REMOVE_ITEM SOURCES_64 ${DSECOND_SRC} )
529540 add_library (${LAPACKLIB} _64_obj OBJECT ${SOURCES_64} )
541+ target_link_libraries (${LAPACKLIB} _64_obj mod_files)
530542 target_compile_options (${LAPACKLIB} _64_obj PRIVATE ${FOPT_ILP64} -DLAPACK_64)
531543 set_target_properties (
532544 ${LAPACKLIB} _64_obj PROPERTIES
@@ -536,6 +548,7 @@ if(BUILD_INDEX64_EXT_API)
536548endif ()
537549
538550add_library (${LAPACKLIB}
551+ $<TARGET_OBJECTS:mod_files>
539552 $<TARGET_OBJECTS:${LAPACKLIB} _obj>
540553 $<$<BOOL :${BUILD_INDEX64_EXT_API} >: $<TARGET_OBJECTS:${LAPACKLIB} _64_obj>>)
541554set_target_properties (
0 commit comments