Simple Makefile generator

Update: For a much more advanced version of this script, see Makefile Generator, version 2 post.

Presented here is a simple bash script for automatic Makefile generating.
This script simply takes all .c, .cpp, .c++ and .cxx files in the current folder, and generates Makefile that builds an executeable from all these sources.
Dependencies are generated using the gcc‘s -MM functionality.

About the script

This script is provided under BSD-style license.

Of course, any comments, reports of use, and suggestions are very much welcome – just leave me a comment! It takes just a moment, and makes me know I didn’t put all the work in posting and updating this for nothing.

Continue reading

How to convert UTF-8 to wchar_t (and back)

While this seems like re-inventing the wheel, it sure is hard to find this code for free on-line (believe me, I tried 😉 ).
Of course, you might wanna use iconv for this, but it’s a bit too huge if all you want is UTF-8 <-> wchar_t.

Fortunately, Alexey Vatchenko has made the code available under BSD license, with a simple and clean interface.

Note: This code is converting UTF-8 to UCS-4-internal, thus it works properly only on systems, where size of wchar_t is 4 bytes (Linux/Unix, BSD, MacOS), but not on Windows, where wchar_t is only 2 bytes!

Happy coding!