home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD2.mdf
/
tools
/
smak
/
smak_c.doc
< prev
next >
Wrap
Text File
|
1992-04-09
|
2KB
|
71 lines
Using SMAK with C source files
SMAK works with C, too! The /2 command line parameter can be used
to specify Microsoft C compiler format.
Note: My knowledge of C is limited to Microsoft's Quick C 2.0, which is
the only C compiler I have tested SMAK with. I would appreciate any
information that others can provide me with on other C compilers.
Entering "SMAK hello.c /2" command at the DOS prompt will "make" the
following sample C program. Note the QCL compiler /c switch that tells
the QCL compiler not to pass the object files to the linker automatically,
since SMAK will do this.
/* =================== Begin program HELLO.C =================== */
#include <c:\qc2\include\stdio.h>
/* Note that SMAK directives are commented off. */
/*
'begin MAKE
' c:\qc2\bin\qcl 'compiler program
' c:\qc2\bin\link 'linker program and options
' begin C 'source file default extension - source list follows
' c:\qc2\samples\hello /c ' main source module with compile options
' begin OBJ 'object file default extension - object list follows
' begin LIB
' c:\qc2\lib\slibce 'linker library
'end MAKE
*/
main()
{
printf (" HELLO! (compiled and linked with SMAK, written in Quick C 2.0)");
}
/* ==================== End program HELLO.C ==================== */
Alternately, you could rely on the QCL program to do the linking, rather
than SMAK, by using the following make directives:
/*
'begin MAKE
' c:\qc2\bin\qcl 'compiler program
' 'no linker program, QCL handles linking
' begin C 'default source extension - source list follows
' c:\qc2\samples\hello ' main source module with compile options
'end MAKE
*/
This is not desirable, however, as all compiler options and link commands
would have to be specified on a single line along with the main source
module, just as you would do from the command line. For more complex,
multi-module programs, the first SMAK script is more manageable and
clearer. The organized, columnar approach that SMAK uses makes it
preferable to the QCL spaghetti-code method.