At age 6, Marvin Hamlisch was accepted into Julliard. His teachers anticipated the child prodigy would become as proficient a pianist as Vladimir Horowitz.

But Hamlisch wanted to be Cole Porter.

The genius composer, who died last August at age 68, was honored with both the Pulitzer Prize and Tony Award for the Broadway juggernaut “A Chorus Line,” which opened in 1975 and racked up 6,137 performances to become the longest-running production in history when it closed 15 years later.

He also was awarded three Oscars, four Grammys, four Emmys and three Golden Globes.

“The Way We Were,” “Nobody Does It Better” and “Looking Through the Eyes of Love (Theme from Ice Castles)” were written by Hamlisch. His first film score was “The Swimmer” in 1968, and his last was Matt Damon’s “The Informant” in 2009 — with “The Sting,” “Three Men and a Baby,” “Sophie’s Choice,” Walt Disney’s “The World’s Greatest Athlete,” and Woody Allen’s “Take the Money and Run” and "Bananas" in between.

Hamlisch’s astounding legacy is celebrated in PBS’ “What He Did for Love,” airing on KUED on Friday, Dec. 27, at 8 p.m.

But what the documentary makes clear is that Hamlisch was a loving man with an irrepressible generosity.

On random occasions, he would arrive unannounced at senior care facilities and play the piano for small groups of elderly residents.

Near the end of his life, he needed a kidney transplant and he told his wife, Terre Blair Hamlisch, he would rather die than be ahead of someone on a waiting list. But he didn’t have to worry. A close friend insisted Hamlisch receive a kidney he would donate.

“Marvin’s astounding musical genius was certainly breathtaking, but it was his irrepressible joy for life and his unending generosity that constantly had me in awe,” said the film’s writer and director, Dori Berinstein, who is a Tony-winning Broadway producer for “Thoroughly Modern Millie” and “One Flew Over the Cuckoo’s Nest.”

Because of Berinstein’s friendship with Hamlisch, the production team was granted exclusive access to Hamlisch’s personal archival treasure trove and received wholehearted cooperation from his family and a long list of celebrity admirers.

Filmmakers recorded conversations with Barbra Streisand, Carly Simon, Steven Soderbergh, Quincy Jones, Ann-Margret and songwriter Carole Bayer Sager, whose relationship with Hamlisch prompted Neil Simon to develop the Broadway musical “They’re Playing Our Song,” with music by Hamlisch and lyrics by Sager.

Viewers will also be amazed with the deeply personal interview with Hamlisch’s wife, Terre. His housekeeper and a friend’s housekeeper connected the two, and they carried on a phone romance for months. Hamlisch proposed without ever having met her, and their relationship revitalized his life.

According to Hamlisch, “If I had a conversation with God and said, ‘This is exactly what I need,’ he would’ve brought me this woman."