Chemotactic motion in a chemical gradient is an essential cellular function that controls many processes in the living world. For a better understanding and more detailed modelling of the underlying mechanisms of chemotaxis, quantitative investigations in controlled environments are needed. We developed a setup that allows us to separately address the dependencies of the chemotactic motion on the average background concentration and on the gradient steepness of the chemoattractant. In particular, both the background concentration and the gradient steepness can be kept constant at the position of the cell while it moves along in the gradient direction. This is achieved by generating a well-defined chemoattractant gradient using flow photolysis. In this approach, the chemoattractant is released by a light-induced reaction from a caged precursor in a microfluidic flow chamber upstream of the cell. The flow photolysis approach is combined with an automated real-time cell tracker that determines changes in the cell position and triggers movement of the microscope stage such that the cell motion is compensated and the cell remains at the same position in the gradient profile. The gradient profile can be either determined experimentally using a caged fluorescent dye or may be alternatively determined by numerical solutions of the corresponding physical model. To demonstrate the function of this adaptive microfluidic gradient generator, we compare the chemotactic motion of Dictyostelium discoideum cells in a static gradient and in a gradient that adapts to the position of the moving cell.