A sensitive porosity adjoint method (SPAM) for optimizing the topology of fluid machines has been proposed. A sensitivity function with respect to the porosity has been developed. In the first step of the optimization process, porous media are introduced into the flow regime according to the sensitivity function. Then the optimized porous media are transformed to solid walls. The turbulent flow in porous media is accounted for by a modified eddy-viscosity based turbulence model. Its influence on the adjoint equations is nevertheless neglected, which refers to the so called frozen turbulence assumption. A test case of application in terms of the turbulent rough wall channel flow shows that a considerable reduction of the objective function can be obtained by this method. The transformation from porous media to solid walls may have important effect on the optimization results.