make is not a standard part of DOS, it is part of the djgpp C compiler. If you want to use make, you must first install a copy of djgpp. Check out the djgpp home page for more information.
make requires a lot of memory. I needed to boot a bare minimum DOS configuration in order to get it to work. I don't know what the minimum is, but it is somewhere between 560K and 603K. So, if you get an 'out of memory' error, then you will have to create config.sys and autoexec.bat files that do not load too many devices. Alternatively, you could create a boot menu that would let you select from various configurations, or create a floppy boot disk.
A makefile allows you to automate the process of compiling, linking and running a program. Basically, you describe in the makefile what the dependencies are. For example, when you want to create an executable file, you usually link an object file, so this would be a dependency in a makefile: the executable depends on the object file, if the object file changes, then relink it to recreate the executable. Similarily, the object file depends on the source file, so another dependency in the makefile wuold be: when the source file changes, then recompile it to recreate the object file. Notice that the dependencies can effect each other. If the source file changes, then the object file will be recreated, but then since this is a new object file, the executable will have to be recreated. In this way, you are freed from the task of always recompiling and relinking. All you do is change the source code, and then make the executable using the makefile. The makefile will check to see what other files need to be recreated, and will only recreate those that are affected by the changed source file.
I will use the compiler gcc to compile my C programs. Here is an example of a makefile that would create an executable called my_prog.exe from the C source file my_prog.c
my_prog.exe: my_prog.c gcc -o my_prog.exe my_prog.c
Since gcc can compile and link, I only have to describe one dependency: the executable depends on the source code. Just put the above lines into a file named makefile. Note that the second line must begin with a tab.
Here is a more complicated example. Suppose I have a file called my_prog.c that has a statement #include "my_inc.h", and that the body of my_inc.h is in my_inc.c. Then, I would put the following lines in my makefile to describe the dependecies
my_prog.exe: my_prog.o my_inc.o gcc -o my_prog.exe my_prog.o my_inc.o my_prog.o: my_prog.c gcc -c my_prog.c my_inc.o: my_inc.c gcc -c my_inc.c
The -o option indicates the name of the executable. The -c option tells gcc to compile, but not to link. By separating the dependecies as above, it reduces the amount of recompiling that needs to be done. For example, once the .o files exist, only the file that changes needs to be recompiled.
The compiler for Ada programs is also gcc, but the linker is gnatbl. Gere is a simple example to run a file named my_prog.adb
my_prog.exe: my_prog.ali gnatbl -o my_prog.exe my_prog.ali my_prog.ali: my_prog.adb gcc -c my_prog.adb
Here is an example that uses a package specification, my_pack.ads, and a package body, my_pack.adb. I am assuming that there is a statement 'with my_pack;' in my_prog.adb. It is not necessary to compile the specification file, .ads.
my_prog.exe: my_prog.ali my_pack.ali gnatbl -o my_prog.exe my_prog.ali my_prog.ali: my_prog.adb my_pack.ads gcc -c my_prog.adb my_pack.ali: my_pack.ads my_pack.adb gcc -c my_pack.adb
As a final example, suppose that my_prog.adb uses a generic package specification, my_gen_pack.ads, and a generic body, my_gen_pack.adb. Notice that the .ali file depends on the generic package.
my_prog.exe: my_prog.ali gnatbl -o my_prog.exe my_prog.ali my_prog.ali: my_prog.adb my_gen_pack.o gcc -c my_prog.adb my_gen_pack.o my_gen_pack.ads my_gen_pack.adb gcc -c my_gen_pack.adb
The command to read the makefile is make my_prog.exe. The argument to the make command is the name of the executable that you want to create. It is possible to have the dependencies for many executables in the makefile, so the argument indicates which one to build. Make will only rebuild those units that depend on other units that have been modified.