Is there a way to construct a task for a utility like flex or bison

Usually one uses make files files for this, but I’m in the java universe.
I have a state machine compiler and I need construct task or a series of tasks that track dependency and use file time-stamp information for recompile.
How do I do this.
The compiler is a java app and it generates java files.