Is there a book or a source containing the whole history of Soft Machine and Gong? In particular focusing on the interaction between their members during the sixties and before their foundation?
Instead of searching specifically for literature concerning Soft Machine and Gong I suggest that you look into The Canterbury Scene instead.
The Canterbury scene (or Canterbury Sound) is a subgenre of, or sibling to, progressive rock. The term describes a loosely defined style of music created by a number of improvisational musicians, some of whom were based in the city of Canterbury, Kent, England during the late 1960s and early 1970s. from Wikipedia
There are various articles on the web such as:
CANTERBURY SCENE : A Progressive Rock Sub-genre
The Canterbury Scene: The Sound Of The Underground
And probably many more.