As it is well known (see for example this question or this one), the GPL licenses do not cover the output of a GPL-licensed program.

So, I could for example generate some pictures with a GPL-licensed program and include these pictures into my non-GPL-licensed software without any issues.

Now consider the following scenario: Given a GPL program that generates source code files (either based on a template or completely out of nothing), can I include and compile this source code into my non-GPL-licensed program just as I could with a picture? Suppose that the generated file does not contain any license header, as otherwise the answer would be obvious.

Technically, I cannot see much difference between a generated picture and a generated text file (that happens to be used as source code). However, I have a strange gut feeling with this.

2 Answers 2


When we say "the GPL doesn't cover the ouput of a program" what we mean precisely is that the license of a program's output data is a function of the license on the particular input data used to produce that output, rather than a function of the license on the program that performed the input-to-output conversion. If a program produces output such that the output contains a derivative of GPL-licensed material (as your jurisdiction's copyright law understands derivative works), then the GPL's copyleft obligations would indeed apply to that output. The license terms of the program that mechanically produces the output are not relevant to the license terms of the program's output

The GPL FAQ covers the substance of this question pretty well, and notes that if the GPL-licensed part of the output can be discretely removed from the rest of the output, users may avoid GPL obligations on the output by removing that part:

Is there some way that I can GPL the output people get from use of my program? For example, if my program is used to develop hardware designs, can I require that these designs must be free?

In general this is legally impossible; copyright law does not give you any say in the use of the output people make from their data using your program. If the user uses your program to enter or convert her own data, the copyright on the output belongs to her, not you. More generally, when a program translates its input into some other form, the copyright status of the output inherits that of the input it was generated from.

So the only way you have a say in the use of the output is if substantial parts of the output are copied (more or less) from text in your program. For instance, part of the output of Bison (see above) would be covered by the GNU GPL, if we had not made an exception in this specific case.

You could artificially make a program copy certain text into its output even if there is no technical reason to do so. But if that copied text serves no practical purpose, the user could simply delete that text from the output and use only the rest. Then he would not have to obey the conditions on redistribution of the copied text.

The "see above" reference about Bison is

Some programs copy parts of themselves into the output for technical reasons—for example, Bison copies a standard parser program into its output file. In such cases, the copied text in the output is covered by the same license that covers it in the source code. Meanwhile, the part of the output which is derived from the program's input inherits the copyright status of the input.

So, this substantially comes down to how your program produces its output code, and how the code templates used by the program are licensed -- if indeed the templates are creative enough to qualify for copyright protection in the first place.


The GPL does not carry forward to things created by software licensed under the GPL (unless the output contains other GPL licensed code, like libraries. Although, most examples of that have the linking exception applied for this reason.) This is for practical, as well as ideological reasons.

Imagine if MS Word 2009™ (or other word processor) required you to give Ballmer's cousin first right to license any screenplay you wrote in it. Such software would cease to be useful.

To require licensing on the output of some GPL licensed software would fly in the face of "Freedom 0" To run (your copy of) the program in any way you see fit.

There's a reason it comes 0th, it's the part of the GPL that makes it clear there's no obligation on users of GPL software to fulfill any terms to use the software once they've got a copy of it.

Obligations only kick in when you provide copies of the software to others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.