What is the first variation of an indicator function? I read in a paper which wants to find the minimizer to the following energy function
$$J(u) = \int_{\Omega} |\nabla u|^2 + \chi(\{u>0\})Q^2 dx $$
where $Q$ is a measurable function and $\chi$ is the indicator function. 
I also read in another paper which wants to find the minimizer to
$$J(u) = \int_{\Omega} |\nabla u|^2 + \mathcal L(\{u>0\}) dx $$
where $\mathcal L$ is the Lebesgue measure. 
How can I compute the first variation of these functionals? I don't know how to deal with $\chi, \mathcal L$.

The term $\mathcal L(\{u>0\})$ (or its weighted analog $\int_{u>0} Q^2$) is not even continuous with respect to $u$: consider what happens for constant $u$. But one can write down some sort of variation when the gradient of $u$ does not vanish "too much". 
Consider a point $x_0$ with $u(x_0)=0$ and $\nabla u(x_0)\ne 0$. Locally the function $u$ looks like $u(x) \approx (x-x_0)\cdot \nabla u(x_0)$. Within a ball of radius $r$, this linear function is positive on the set of measure $r^n|B^n|$ where $|B^n|$ is the measure of the unit $n$-dimensional ball. Adding a constant $c>0$ to the linear function increases the measure by about 
$c|\nabla u(x_0)|^{-1} r^{n-1} |B^{n-1}|$, because this increase comes from a cylinder of height $c|\nabla u(x_0)|^{-1}$. 
From these local considerations, recognizing $r^{n-1} |B^{n-1}|$ as surface element of the (smooth, by the implicit function theorem) surface $\{u=0\}$, one concludes that the result of replacing $u$ by $u+\epsilon \phi$ is
$$
\epsilon \int_{\{u=0\}} |\nabla u(x)|^{-1}\phi(x)\,dx
$$
which means that the first variation of the functional $\mathcal L(\{u>0\})$ is 
$$
\phi \mapsto \int_{\{u=0\}} |\nabla u(x)|^{-1}\phi(x)\,dx
$$
For the weighted case it is 
$$
\phi \mapsto \int_{\{u=0\}} |\nabla u(x)|^{-1}\phi(x)Q^2(x)\,dx
$$
