Hacker News new | ask | show | jobs
by mmfZ4e4OqQ7RRwP 4190 days ago
I don't know anybody who redistributes source code as a single C file, but you could try concatenating the files into one. Usually people redistributing source code don't mind having several files bound together by some make|build script. The nim compiler has the --genScript switch to make one. Most people willing to get something redistributable prefer a binary static|dynamic library or final executable.
1 comments

> I don't know anybody who redistributes source code as a single C file

SQLite pioneered this approach, called an Amalgamation. It offers some noticeable advantages:

https://www.sqlite.org/amalgamation.html

It is gaining some followers:

https://github.com/vinniefalco/Amalgamate

http://stackoverflow.com/questions/2719311/tool-to-create-an...

http://lua-users.org/lists/lua-l/2008-08/msg00594.html

> Usually people redistributing source code don't mind having several files bound together by some make|build script.

A single .c file is easier to integrate into various build systems. For example a Visual Studio project, or another Makefile without needing a separate script. It's just cleaner.

> Most people willing to get something redistributable prefer a binary static|dynamic library or final executable.

These aren't portable like a C source file is.