Files
oldlinux-files/ftp-archives/tsx-11.mit.edu/1993-12-07/sources/usr.bin/icmake.doc
2024-02-19 00:24:15 -05:00

278 lines
13 KiB
Plaintext

=============================================================================
ICMAKE
the Intelligent C-like MAKEr, or
the ICce MAKE utility
Copyright (c) Frank B. Brokken and Karel Kubat
ICCE, State University of Groningen, Netherlands
=============================================================================
Introduction
------------
Icmake is a hybrid between a 'make' utility and a 'shell script'
language. Originally, it was concocted to provide a useful tool for
automatic program maintenance and system administrative tasks on MS-DOS
platforms. As we learned to appreciate its flexibility, Icmake was
eventually ported to Unix platforms (SCO and Linux). By now Icmake also runs
on a HP-Unix platform.
To give an impression of "what Icmake does", take a look at the
following makefile. It is used for automatic program maintenance, where it
is assumed that in some directory all files with the extension ".c" (C
source files) constitute a program "myprog". The automatic maintenance makes
sure that, once Icmake is invoked, C source files which are more recent
(newer) than a library file "libmyprog.a" are recompiled and placed in the
library. A new program is then made and installed in a directory
"/home/user/bin".
void main ()
{
list
cfiles; // list of .c files
int
i; // counter variable
string
sourcefile; // string with name of
// 1 source file
cfiles = makelist ("*.c", younger, // cfiles is now a list of
"libmyprog.a"); // all files to recompile
if (cfiles) // if there are any files..
for (i = 0; i < sizeof (cfiles), // recompile them
i++)
{
sourcefile = element (i, cfiles); // get the name from the list
exec ("gcc", "-c -Wall", sourcefile); // recompile
}
if (makelist ("*.o")) // any "*.o" files here?
{
exec ("ar", "rvs", "libmyprog.a", "*.o"); // add to library
exec ("rm", "*.o"); // remove them
exec ("gcc", "-o myprog", "libmyprog.a"); // re-link program
exec ("mv", "myprog", "/home/user/bin"); // and install in bin dir
}
}
The source files for Icmake look remarkably like C sourcefiles. The
resemblance is so close that this cannot be pure chance! Yes, we have
implemented Icmake to be a language with a syntax which largely overlaps C.
Since we know how to program in C, we decided that we didn't want to learn
some new macro language. The Icmake language is a "subset" of C in the
sence that not all operators or functions of C are implemented (but a good
deal are, e.g., gets(), getch(), printf(), etc.). The Icmake language has
its own extensions to make it a handy language for the purpose of
maintenance: e.g., the operator "younger" compares two files in respect to
their date of last modification, a type "list" is defined to hold several
strings.
The usage of Icmake is not restricted to program maintenance. The
setup, which allows for functions, arguments, local or global variables, the
calling of external programs, etc. makes Icmake also extremely suitable as
a shell script language. E.g., it is easy to accomplish to let Icmake
figure out which files need to be backupped since the last backup date and
to start a process to do so, to send mail about it etc.
This guide provides a short description how Icmake can be ported to
new platforms. The documentation for the usage of Icmake, including a
description of the grammar and of all built-in functions, comes with the
distribution files.
Installing Icmake
-----------------
The installation files for Icmake come as an archive, e.g.,
"icmake.zip" or "icmake-6.00.tar.gz". These archives unpack to several
directories and files. Please note that the archives unpack to the *current*
directory.
To unpack the archives, create an appropriate directory (e.g.,
"/usr/local/src/icmake" for Unix platforms, or "c:\c\icmake" for DOS) and
change-dir to that directory. Use an appropriate archiver to unpack. Some
possibilities are described below:
(a) The archive in the form ".tar.Z" can be unpacked using
"cat icmake-5.00.tar.Z | uncompress | tar xvf -"
(b) Archives in the form ".tar.gz", ".tar.z" or ".tgz" can be unpacked using
"gzip -c -d icmake-5.00.tar.gz | tar xvf -"
(c) The archives with the extension ".zip" can be unpacked using
"unzip icmake.zip" or "pkunzip -d icmake.zip".
The extraction of files from the archive should yield a lot of C
source files in a number of directories. The default distribution of Icmake
may or may not contain makefiles for the Unix-utility "make"; but the
programs can always be created by compiling all files "by hand".
Furthermore, the directory "dosbin" contains compiled versions of the Icmake
programs for DOS platforms.
To compile all files "by hand" in order to make the programs, please
follow these steps:
(a) Change-dir to the directory "rss". This directory contains sourcefiles
for the Runtime Support System. These functions are used in all the programs
of the Icmake family.
Compile all files, using the appropriate compiler flags which cause your
compiler to compile-only and which cause it to treat "char"s as "unsigned
char"s. If your compiler supports memory models, choose the "small" model.
E.g., these compiler flags are:
for GNU's gcc: gcc -c -funsigned-char
for Microsoft C 7.00: cl -c -J -AS
While compiling, you may need special definition flags to produce workable
code for 'exotic' (well.. exotic to me) systems. Please check the section
below to see if you need any special flags.
Next, place the produced object files into one library. A suggested name is
"libicrss.a" for Unix systems, or "icrss.lib" for DOS systems. See the
documentation of your library manager ("ar" or "lib") for the required
command line. E.g., for Unix systems try "ar rsv libicrss.a *.o" in the
directory "rss".
(b) The following five directories must also be created from the archive:
"make", "pp", "comp", "exec", "un". The directories hold respectively the
files needed for the top-level program "icmake", for the preprocessor
"icm-pp", for the compiler "icm-comp", for the executor "icm-exec" and for
the unassembler "icmun". These program names are on Unix-based systems
without extension; supply ".exe" for DOS.
Change-dir to each of these directories, and compile and link all .c files
into the appropriate program. E.g., for a Unix system you might type:
cd make
gcc -funsigned-char -o icmake *.c ../rss/libicrss.a
cd ../pp
gcc -funsigned-char -o icm-pp *.c ../rss/libicrss.a
cd ../comp
gcc -funsigned-char -o icm-comp *.c ../rss/libicrss.a
cd ../exec
gcc -funsigned-char -o icm-exec *.c ../rss/libicrss.a
cd ../un
gcc -funsigned-char -o icmun *.c ../rss/libicrss.a
cd ..
For a DOS platform with the Microsoft compiler, you might type:
cd make
cl -AS -J -Feicmake.exe *.c ..\rss\icrss.lib
cd ..\pp
cl -AS -J -Feicm-pp.exe *.c ..\rss\icrss.lib
cd ..\comp
cl -AS -J -Feicm-comp.exe *.c ..\rss\icrss.lib
cd ..\exec
cl -AS -J -Feicm-exec.exe *.c ..\rss\icrss.lib
cd ..\un
cl -AS -J -Feicmun.exe *.c ..\rss\icrss.lib
cd ..
Whichever platform you use, please make sure to include the "unsigned chars"
flag when compiling, and name the resulting program by the appropriate name
(one of "icmake", "icm-pp", "icm-comp", "icm-exec", "icmun", optionally
followed by an extension ".exe" for DOS systems). The reason for this is the
fact that the top-level program "icmake" must be able to call all subsequent
programs, of which the names therefore must be known. Furthermore, you may
need special compilation flags for rare systems (see the section below).
During the compilation your compiler may report some warnings. You can
ignore these.
(c) If all goes well, you've now created all necessary programs. Move the
executable files to a system directory; e.g., "/usr/local/bin" for Unix
systems, "c:\sys\bin" for DOS systems, etc.
(d) For all subsequent releases of Icmake which you may wish to install, you
can use your old programs of the Icmake family and the included icmake-files.
E.g., the installation includes a file "unix.im" to create Icmake for Unix
platforms. Prior to using the makefiles, you may wish to edit this file, to
define your favorite compiler, your system directory, etc. Even when you
successfully create Icmake by hand, it may be a good idea to re-make it with
the makefile to check its workings. Just type "icmake unix", or "icmake
dos-msc" or whatever is appropriate; then follow the instructions which are
printed by the makefile.
Special flags while compiling
-----------------------------
A large part of the source code of Icmake should compile on any
platform. The exceptions we have encountered so far are the following:
(a) On MSDOS platforms, the constant MSDOS must be defined. This symbol is
by default defined by the Microsoft compiler. For other compilers on DOS
systems, a flag "-DMSDOS" may be necessary when invoking the compilations.
Non-DOS systems should, obviously, *not* have a defined symbol MSDOS.
(b) Sparc stations which require double-word alignment, require that the
constant SPARC be defined. Parts of the code, especially the file
"comp/patchup.c", handle assignments differently when SPARC is defined. On
such systems, "-DSPARC" should be added to the compiler flags. (Many thanks
to Wilco Oelen (W.Oelen@el.utwente.nl)).
The Documentation
-----------------
Icmake is documented in a Postscript file, "icmake.ps", located in
the directory "doc". This file is generated from a .dvi file using dvips,
and can be processed with GhostScript. Note that the file is generated for
a printer resolution of 300 dpi, which suits a LaserJet family printer. If
your site lacks the means to print this file, you can mail us at the address
below to obtain a printed copy of the documentation. (However, we will
charge you a small amount to cover our costs).
The directory "doc" furthermore contains the file "icmake.1". This
is a crude "man" page for Unix systems. You can install it by copying it to
a directory which contains formatted manual pages. To use this feature,
your "man" command must be able to show an already-formatted manual entry.
E.g., on Linux systems you can copy this file to "/usr/man/cat1". Typing
"man icmake" will then show the information. Some man systems also support
compressed manual pages. On these systems you may achieve a lower disk
usage by compressing the file "icmake.1" to "icmake.1.Z", using the Unix
program "compress".
A few makefiles are provided as examples in the directory
"examples". You may wish to look at these to see how makefiles can be
organized.
Some Legal Stuff
----------------
Icmake is shareware. This means that no fee is charged for it. As
with everything that's free, there's no pay but also *absolutely no
warranty*. Furthermore, you are allowed (and encouraged) to distribute
Icmake, provided that you include this information with each distribution
and provided that you do *not* charge any amount for it. Not even the $5
for shipping.
The source files and the documentation for Icmake are copyrighted by
us. The reason for this is (a) that we'd like to have always the last
version of Icmake, and (b) that we'd like to have the last word in all
modifications. If you have requests (or even better, "working code" to
include in Icmake) please mail us and we'll gladly oblige when we find the
time.
Requests, Bug Reports, etc.
---------------------------
It is possible, even highly likely, that the version of Icmake which
you received contains bugs. We are continuously fighting a battle against
the insects which pop up from time to time to tease us.
Therefore, we'd very much appreciate it if you'd let us know if you
encounter any bugs. Also, if you have requests or comments about the
programs or the documentation, mail us. We can be reached at:
Frank Brokken Karel Kubat
e-mail: F.B.Brokken@icce.rug.nl K.Kubat@icce.rug.nl
phone: (+31) 50 63 36 88 (+31) 50 63 36 47
address: Westerhaven 16 Westerhaven 16
Groningen Groningen
Netherlands Netherlands