BOSTON – He is one of the legends of Boston comedy, but this is not a joke. Well, it is kind of a joke, but mostly serious.

Mike Donovan, 57, a stand-up comedian, Southie guy, history madman, is ready to publish his book. Yes, “the book,” that thing that the comedy world has watched him obsess over like a madman for three decades — he says it is ready. And, wait for it.

“It’s 1.6 million words,” Donovan said when he made the announcement recently on stage at a sold-out Wilbur Theatre, where he was on a panel with some of the great names of the local comedy scene.

To put that into context, a guy from the stand-up comedy world — where stories are measured in minutes — has written a manuscript that is twice the length of the Bible. Even stranger is what the book is about.

“It’s a general history of the United States for general readers with a touch of humor,” he said, “and I try to take out all the boring things that are in history books and liven it up, spice it up a little, a fake story now and then based on a true story.”

It is the longest joke ever written.

The comedy world has never known what to make of Mike Donovan. Other comedians, he admits, kind of just stare at him. “He’s not a normal guy,” Steven Wright, the comedian and his old buddy, says. “I’m saying that in a good way. His head is not a casual head. He’s got like 18 Harvards up there.”

For the few people who knew what he was up to — like Brian Kiley, the head monologue writer for Conan O’Brien, who reads a small section on Donovan’s website while he eats his lunch every day — the book did not seem like something that could be finished; it was alive, as alive as Mike Donovan, and growing every minute he worked on it, which was almost every minute he was awake.

Now the publishing world will have to figure out what to make of Donovan, because he is ready to go to it.

The question is: When he has been funny for a living for so long, can Mike Donovan be taken seriously as a historian?

He thinks so, and it is precisely because he is an outsider. “It’s the same reason people vote for a farmer,” he likes to say.

It is 1940, the early days of World War II. The Nazis have invaded France and are coming for England, and Donovan quotes Winston Churchill, standing before the British Parliament, delivering one of his famous speeches.

“We shall fight them on the beaches, we shall fight on the landing grounds, we shall fight in the fields and in the streets, in the pubs, in the hills, and we shall never surrender.”

OK, so Churchill did not say that thing about the pubs. Donovan threw that in there. “Why not?” he said. The book is about 90 percent true, but he has written “Based on a true story” at the beginning of each chapter. “Why should Hollywood get to do that and no one else?”

But behind all the humor is serious study. Those who know him say they have never seen anyone work harder, longer, on a single thing than Donovan has on his book.

Barry Crimmins can remember meeting Donovan in 1979, when Crimmins was running the comedy club at the Ding Ho in Cambridge, the wildest room in the wildest days of the local scene. “He’d duck into a corner and read a book, then go up and kill on stage, then go home and get four more hours of work in,” said Crimmins, who soon came to conclude that comedy was really just a way for Donovan to support himself while he chased his history obsession. “He became a great comic to give himself a scholarship to life, to a lifetime of study. It was ingenious.”

“Here it is,” Donovan says after spending a few minutes scanning the thousands of books that fill the office in his Brookline apartment. Not only has he read them, but he has marked up nearly every margin with his humorous, and often R-rated, commentaries. He slides an old volume from a shelf: “The History of U.S. Naval Operations in WWII.” When he was about 12, it was the book he pulled from the stacks at the South Boston branch library, the book that began it all.

“I’m not understanding it, but I’m loving it, and it drove the librarians crazy,” he says. “They were always kicking me out of the adult section. They would take my book away and make me go to the kids’ section. But I was addicted.”

At South Boston High School, Donovan would cut out of school and ride his bicycle to the main library in Copley Square and read issues of the Boston Globe on microfilm — starting with the day Hitler invaded Poland in 1939 and finishing with the capture of Guadalcanal in 1943. He never got his diploma, but he found his calling.

From there it was history, all day every day. He went through phases on Russia and the Middle East. Then he started reading U.S. history textbooks. He drank them in but also hated them because, according to him, they were mostly wrong; skewed, dated, revisionist, pandering, politically correct. So he set out to fix that.

For 12 years, he read feverishly — “I make time for my wife, but I can see my family at Christmas” — until, just before his 50th birthday, when he got depressed. He felt a fear inside that he was never actually going to do it, actually going to fill a blank page, that all the things in his head would die with him.

“I was thinking, ‘I’m going to take it to my grave,’ ” he said. Recalling that moment, he dropped to the ground in the pose of a sprinter waiting for the gun to go off.

“I had this vision when I was 49, when I finally started writing, of sprinting through my 50s,” he said, springing out of the crouch and taking a few steps. “I’m doing a 10-year sprint. I’m giving it all I’ve got. I’m afraid of running out of energy. I’m afraid of dying too soon to get it finished.” He returns to his chair, worked up at the thought.

“And now, I feel grateful.”

Since that vision, he has written 4,200 pages he is proud of. That is what he wanted to leave behind. Now he wants to make sure it leaves a mark.