How is a Hamiltonian constructed from a Lagrangian with a Legendre transform many textbooks tell me that Hamiltonians are constructed from Lagrangians like
$$L=L(q,\dot{q})$$
with a Legendre transformation to obtain the Hamiltonian as
$$H=\dot{q}\frac{\partial L}{\partial \dot{q}}-L$$
but none of the textbooks explain how this is done.
My specific problem is that I have Lagrangians that do not depend on $\dot{q}$ and therefore should have $\frac{\partial L}{\partial \dot{q}}=0$, hence $H=-L$. But my impression from the clues I have is that it is not that simple.
Let's say the Lagrangian is
$$L(q)=\ln(q)-(2q-10)\lambda$$
Now as far as I know the Legendre transformation should give a function
$f^*(p)=\sup(pq-L(q))$ (this implies $p=\frac{\partial L}{\partial q}$) which is obtained by substituting the stationary point $q_s$ of $\sup(pq-L(q))$ into $pq-L(q)$ thus getting $f^*(p)=pq_s-L(q_s)$ (for instance wikipedia's Legendre Transformation page explains this).
Doing this for the example above: $$\frac{\partial (pq-L(q))}{\partial q}=\frac{\partial (pq-\ln(q)+(2q-10)\lambda)}{\partial q}=p-\frac{1}{q}+2\lambda$$ 
must be 0 for a stationary point, thus $q_s=1/(p+2\lambda)$.
And hence the transformation should be $$f^*(p)=p\frac{1}{p+2\lambda}-\ln(\frac{1}{p+2\lambda})+(2\frac{1}{p+2\lambda}-10)\lambda$$
and this should be the Hamiltonian.
But this equation does obviously have nothing to do with the textbook Hamiltonian. Rather, an answer to another question has in a similar case treated $L(q)$ as being dependent on $\dot{q}$ implicitly (Writing $\dot{q}$ in terms of $p$ in the Hamiltonian formulation ... answer by Qmechanic). It mentions using the Dirac-Bergmann method for obtaining the Legendre transform. 
Trying something along the lines of this other question the above example seems to give
$$p=\frac{\partial L}{\partial \dot{q}}=0$$ 
and 
$$p \approx 0$$ 
(an equality modulo constraint as the answer to the question linked above says).
And then
$H=\dot{q}p-L$.
The difference seems to be that the Legendre transform is done with respect to two different variables, $q$ and $\dot{q}$ - but it was my understanding that it had to be done with respect to all variables the Lagrangian depends on. So how does the $qp_q$ term vanish if we have only the $\dot{q}p_{\dot{q}}$ term left? 
Thanks.
edit: changed ln to \ln as Plane Waves suggested, and sup to \sup. And yes, sup is the supremum over all q, as Vibert said, sorry for forgetting to mention that.
 A: The fact that $p = \large \frac{\partial L}{\partial \dot{q}} = 0$ introduces a problem in the equivalence between Lagrangian and Hamiltonian representations. 
The idea is that the Hamiltonian representation plus the constraint $p = 0$ is equivalent to the Lagrangian representation
The Lagrangian $L$ is a function of $q$ and $\dot q$, that is $L(q, \dot q)$
If we work with the Lagrangian, we will apply the Euler-Lagrange equations which are : 
$$\frac{\partial L}{\partial q} = \frac{d}{dt} \left(\frac{\partial L}{\partial \dot{q}}\right)$$
Because $\large \frac{\partial L}{\partial \dot{q}} = 0$, the equation is simply $\large  \frac{\partial L}{\partial q} = 0$, that is $  \frac{1}{q} - 2\lambda = 0$, so $q = \frac{1}{2 \lambda}$
Now try to work with the Hamiltonian.
The Hamiltonian $H$ is a function of $q$ and $p$, that is $H(q, p)$
The link between the two is the Legendre transformation : 
$$H=\dot{q}\frac{\partial L}{\partial \dot{q}}-L$$
Because your Lagrangian does not depends of $\dot q$, then $p = \frac{\partial L}{\partial \dot{q}} = 0$, and so : 
$$H(q, p) = - L(q, \dot q) = - \ln(q) + (2q-10)\lambda$$
From this hamiltonian, you get the equations of movement : 
$$\dot q =   \frac{\partial H}{\partial p} ~,~\dot p =  - \frac{\partial H}{\partial q}$$
So we have : 
$$\dot q  = 0~,~\dot p = \frac{1}{q} - 2\lambda \tag{1}$$
From this, we cannot recover the equation obtained from Euler-Lagrange equations, we have to add the constraint $p = 0$.
If $p = 0$,  it means that $\dot p = 0$, and so :
$$q = \frac{1}{2 \lambda}\tag{2}$$
This is coherent with the fact that $\dot q = 0$
A: Functions like yours are often referred to as "Lagrangians" in economic textbooks and such, but in the context of physics a Lagrangian is a functional, not just a function, and implies the concept of action, which in turn implies a dynamic situation.  So you should probably avoid calling it a Lagrangian, at least when in earshot of physicists.  Let's call your function $f(q)$ instead for now.
In the Legendre transformation that leads to the Hamiltonian, the argument of the Lagrangian is $\dot{q}$ and the argument of the Hamiltonian (i.e. the Legendre transformation) is $\frac{\partial L}{\partial \dot{q}}$ (or $p$)--which I think is called the canonical momentum conjugate to $q$.  Both arguments are dynamic in nature.
In the case of a function (not functional) like yours, there is nothing dynamic happening, so better not to try to extrapolate from the derivation of the Hamiltonian.  The Legendre transformation (call it $h$) is simply
$$h \left( m \right)=mq-f(q)$$
Where $m=\frac{df}{dq}$ and $q=q(m)$
This paper might help understand the Legendre transformation better.
A: What is "sup"? Please write "ln" with a backslash $\ln$. Anyway if $L$ is independent of a specific variable, then the canonically conjugate variable is conserved, which means that the energy function (the Hamiltonian) cannot explicitly depend on it. In your case $p_q$ should be conserved so your first intuition is correct: $$H=-L.$$ 
