<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def makelib(self, remake=False, full=True, compiler="gfortran", debug=False, profile=False):
 """Generates a makefile for the code files that reside in the same directory as the source that was parsed by the code parser. :arg full: when True, the shared library is compiled for *all* the code files in the directory not just the one's that are dependencies of the source module. """

        if self.link is None or remake:
            from os import path
            if self.library is not None:
                outpath = path.join(self.dirpath, "{}.a".format(self.library))
            else:
                outpath = path.join(self.dirpath, "{}.a".format(self.name))

            if not remake and path.isfile(outpath): #No need to recompile
                self.link = outpath
                return
                
            dependencies = self._get_lib_modules(full)
            makepath = path.join(path.dirname(self.module.filepath), "Makefile.ftypes")
            if full:
                compileid = "ftypes.all_libs"
                identifier = self.library
            else:
                compileid = "ftypes.{}_c".format(self.module.name)
                identifier = self.module.name
                
            makefile(identifier, dependencies, makepath, compileid,
                     self.module.precompile, False, self.module.parent, "a")
            code = self._compile(path.dirname(self.module.filepath), "Makefile.ftypes",
                                 compiler, debug, profile)
            if code == 0:
                self.link = path.join(path.dirname(self.module.filepath), "{}.a".format(identifier))
                self._copy_so(outpath)
                self.link = outpath
        else:
            #Just make sure it is copied over into the directory where we want to compile the wrapper
            #module for ftypes.
            self._copy_so(self.dirpath)