Implementation of LinkFileList class.
This class contains the list of files to be linked to the object directory
list = LinkFileList(project_setup_dir) list.clean_setup_dir() —- after all units have been generated —- list.get_dont_link_list(units,linkifUDPairs) list.link_files (sourcedir1) list.link_files (sourcedir2) ...... list.link_files (sourcedir9) list.really_link() – this is the one which really makes the links
Get all user options, Global Variables and all units.
By storing this info in a dictionary we have that later add_links overwrite earlier addlinks with the same name check_links method checks for abc.c and abc.F90 type issues
Check if uname or one of its children is present in units
Return a list of files which should not be linked to
Input: unitlist = list of names of all units udpairs = list of all (fname,uname) pairs found Compute list of files which should not be linked to based on the LINKIF directives (fname,uname) in LINKIF means link in fname only if uname is used as a UNIT, otherwise dont link in fname Algo ans = all fnames occurring in LINKIF if (fname, uname) in LINKIF and unit in units such that uname is a prefix of unit.name, remove fname from ans
Link files in with right extension in fromdir to object directory
Note: if blah.c is in fromdir and blah.F90 is in the current directory, blah.F90 gets deleted. Same thing for other groups of extensions.
We now also accept files like abc.F90.x.y.z to stand for .F90 files. When this file is linked it will be linked as “abc.F90” The real extension of a file is the string between the first and the second dots, (or string after the first, if there is no second dot)
NOTE: We dont actually link the files, only queue them up for linking. The real linking is done by calling really_link method
The following method should check if the two files are the same by computing the adler32 checksum. (It is theoretically possibile but UNLIKELY that two different text files produce the same checksum.) However, this version of link_files.py is adapted for machines where the zlib module of Python is unavailable, so if we cannot use it (as indicated by a NameError exception), let the files appear different.
Find the list of files in the current dir with significant extension compare with self.links links no longer present and are not derived files get deleted for links where target has changed the .o file gets deleted target same and has been updated is no problem (make takes care of it)