Added: Following quid's comments I checked out Fuchs's text on infinite abelian groups, and indeed the rank of an arbitrary abelian group is defined in a way so as to take $p$-primary torsion into account. (I simply didn't know this was true.) Thus the rank defined there would be the sum over all the values of the rank function in the sense of 1). In fact
All this seems to indicate, foreven more than my answer, that different notions of rank proliferate.
Added Later: Quid also suggests consideration of the quantity $\operatorname{mg}(M)$, the minimal number of generators of an $R$-module $M$: this is a perfectly arbitrary modulecardinal invariant which is (clearly) finite if and only if $M$ over any commutative ringis finitely generated. Let $R$, we can define be a function $r_M$ withDedekind domain with fraction field $\operatorname{Spec} R$$K$. For a maximal ideal $\mathfrak{p}$ of $R$ and taking values in the cardinal numbersa finitely generated $R$-module $M$, and thenlet $M[\mathfrak{p}^{\infty}]$ be the ranksubmodule of an abelian group in Fuchs's sense$M$ consisting of elements annihilated by some power of $\mathfrak{p}$. Then $M[\mathfrak{p}^{\infty}]$ is the cardinal suma finitely generated torsion module over all the valuesDVR $R_{\mathfrak{p}}$ and is thus a direct sum of the$\operatorname{mg}(M[\mathfrak{p}^{\infty}])$ copies of $R_{\mathfrak{p}}/\mathfrak{p}^k R_{\mathfrak{p}}$. Let us define $tr(M,\mathfrak{p})$ to be this number of copies. (When $M$ is infinitely generated I believe one should also count copies of $K_{\mathfrak{p}}/R_{\mathfrak{p}}$ in a certain sense in order to recover Fuchs's $p$-primary torsion rank functionin the $R = \mathbb{Z}$ case. Let me omit this for now.)
All this seemsNow define
$R(M) = r_M((0)) + \sum_{\mathfrak{p} \in \operatorname{MaxSpec} R} tr(M,\mathfrak{p})$
When $R = \mathbb{Z}$ then $R(M) = \operatorname{mg}(M)$ is the "total rank" in Fuchs's sense. More generally $R(M) = \operatorname{mg}(M)$ when $R$ is a PID. However, I wanted to indicatepoint out that in general the function $\operatorname{mg}$ behaves very badly. This is discussed in $\S$ 6.5.3 of my commutative algebra notes. In particular, even more than my answerwhen $M$ is finitely generated projective, $\operatorname{mg}(M) \geq R(M) (= r_M((0))$ but can be larger. The structure theory shows that different notions of rank proliferateif $r(M) = n$ then $n \leq \operatorname{mg}(M) \leq 2n-1$ and I give examples in the exercises with $(r(M),\operatorname{mg}(M))$ equal to
$(1,1)$, $(1,2)$, $(2,2)$ and $(2,3)$. I would guess that all values in the above range are possible assuming that $\operatorname{Pic} R$ is sufficiently large, but I haven't thought seriously about it.