"MKMK" the Make a Makefile Utility

Hamburg (Germany), the 2nd December 1997.
HTML by Nils Pipenbrinck aka Submissive/Cubic & $eeN
Utility by Luis Crespo

Introduction

MKMK is a small and silly utility I made for my own convinience. Manually creating a MAKEFILE for each project is a boring task, and it is also dangerous: when the project is big enough, the dependencies are really complicated. For example a C++ file could include 8 files, each of which could include some others, and so on. If you omit a dependency, you can change a header file and not recompile all the necessary object files. Then, if you change a structure definition in that header and recompile, your program would probably crash or behave strange. MKMK creates the MAKEFILE for you. It parses your source files and creates a dependency list for each of them, by searching the "#include" strings in your files.

Usage

MKMK exe-name source-list
Exe-name is the name of your executable file. You must specify the extension too. Source-list is the list of your C/C++ source files. You can use wildcards, and you can list several file names. Before blindly running WMAKE, it is better to take a look at the MAKEFILE generated by MKMK. You will see that there is an empty variable, "LIBS". You can put there the libraries your project needs, or else you MUST edit the last line of the MAKEFILE and delete the "library {$(LIBS)}" part. If you don't do so, you will get an error message from WMAKE.

Examples

MKMK myprog.exe *.cpp
This is the most common use of MKMK: you just have to put all the source files in a directory and type something like the command above. MKMK will create a MAKEFILE that will compile and link all the source files in your directory to create "myprog.exe".

MKMK myprog.exe game*.cpp sound\*.c This command will scan all files matching game*.cpp and sound\*.c and create a dependency entry for each of them in the MAKEFILE.

Disclaimer

Well that is what MKMK does. Of course, there is a lot of things that MKMK does not do. For example it does not support assembler sources, so you will have to add their dependencies manually. Also the program could be more configurable, having some definitions in a separage CFG file, and it could generate an output file with a name other than MAKEFILE, specified by the user.
If you use the program and find that it would be useful that MKMK would do something, just code it. That is why I give out the source code. If you add features to the program, please tell me, I would like to know it, and that way I can put together the different enhancements and post them on the web, presumably on the same page you found it. It would be better if the enhancement is given in a separate source file, for the sake of modularity.
Of course, if you find some bug, please tell me, but don't confuse a bug with a missing feature. For example, the C/C++ include file parser is a very simple one and can easily be cheated. I haven't tried to, but maybe comments inside strings can make the parser take wrong decisions. One obvious improvement would be to use a LEX generated parser instead of the "manual" one I have coded. Another missing feature is that MKMK is unable to trace dependencies inside include files that are located in a different directory that the one that included it.

Source Code

MKMK has been sucessfully compiled with BC++ 3.1 and Watcom C++ 10.5. The executable version is the one compiled with BC++ 3.1, and is the only one that has been tested. Well, in fact it's the one I use and that usage is almost the only testing that I have done. Feel free to upgrade the utility to whatever you think useful. If you send it to me, I will post your upgrade in the web and give you the proper credit.
Download mkmk.zip.


© by submissive Valid XHTML 1.1!