1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>hsc - Project Management - Make</TITLE>
<LINK REV="owns" TITLE="Thomas Aglassinger" HREF="mailto:agi@giga.or.at">
<LINK REL="Next" HREF="makefile.html">
<LINK REL="Copyright" HREF="../copy.html">
<LINK REL="Previous" HREF="hscpitt.html">
<META name="ROBOTS" content="NOINDEX, NOFOLLOW">
</HEAD>
<BODY>
<A HREF="../index.html"><IMG SRC="../image/main.gif" ALT="Contents" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<IMG SRC="../image/noindex.gif" ALT="-----" ALIGN="middle" WIDTH="70" HEIGHT="16">
<A HREF="../copy.html"><IMG SRC="../image/copy.gif" ALT="Copyright" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<A HREF="index.html"><IMG SRC="../image/back.gif" ALT="Up" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<A HREF="hscpitt.html"><IMG SRC="../image/prev.gif" ALT="Previous" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<A HREF="makefile.html"><IMG SRC="../image/next.gif" ALT="Next" ALIGN="middle" WIDTH="70" HEIGHT="16"></A>
<HR>
<H1>Make</H1>
<P>This chapter shortly describes a popular, but nearly unusable tool
called <KBD>make</KBD>, which can be used to solve project management tasks
when using <KBD>hsc</KBD>. This is not the only tool which is able to do so,
but it should exist on most platforms.</P>
<H2>What is Make?</H2>
Let's start with a quote from the documentation to <KBD>GNUmake</KBD>:
<BLOCKQUOTE> <P>The `make' utility automatically determines which
pieces of a large program need to be recompiled, and issues commands
to recompile them. [...]</P>
<P>You can use `make' with any programming language whose compiler can
be run with a shell command. Indeed, `make' is not limited to
programs. You can use it to describe any task where some files must be
updated automatically from others whenever the others change.
[...]</P>
<P>To prepare to use `make', you must write a file called the
"makefile" that describes the relationships among files in your program
and provides commands for updating each file.</P>
</BLOCKQUOTE>
<P>As of it's general purpose design, <KBD>make</KBD> also fits to be used
in combination with <KBD>hsc</KBD>. So far for the good part.</P>
<H2>Which Make to Use</H2>
<P>One of the worst things about <KBD>make</KBD> is that - as far as I know -
it comes from the fossil Unix world, with the usual results. There are
several programs with the same name, but different features.
Furthermore, you will have to bother with many occurrences of cryptic
looking characters.</P>
<P>This documentation will always refer to a version of make commonly
known as <KBD>GNUmake</KBD>, as it is freely distributable, exists
as source code and has been ported to most platforms.</P>
<P>(For Amigoids: A tool called <KBD>smake</KBD> has become very
popular under this system. Not because it is so powerful - on the
contrary - but because it was shipped with the SAS/c package. You can
put away this tool for <KBD>hsc</KBD>, probably not a single example given
within this manual or the supporting material will work.)</P>
<H2>Why Make Sucks</H2>
<P>One thing nearly all <KBD>make</KBD>-tools have in common is the inability to
produce useful error messages - if any at all.</P>
<P>Most of them are very picky about blanks and tabs (which can be
created by pressing the <KBD>TAB</KBD> key). Tabs in plain text file
are one of the most brain-damaged concept the (so called) modern
computer industry has established. Of course it is easy for a machine
to distinguish between spaces and tabs by their ASCII code. But the
user will see a blank space on the screen in both cases.</P>
<P>This becomes even worse, as many editor applications do not care
about tabs and replace them by spaces, normally without notifying the
user about that. This can not only be annoying, as these editors in
most cases are not sure if they should replace a tab by four or eight
space characters, often resulting in an unexpected looking display.
Even worse, picky tools (like most <KBD>make</KBD> tools) will interpret the
<I>Makefile</I> as trashed. So make sure you are using a decent editor. For
example, <KBD>memacs</KBD> coming with the standard Workbench does a
good job on this.</P>
<H2>Makefiles and Pattern Rules</H2>
<P>As already mentioned above, you will have to write a so called
<I>Makefile</I>. This is by far the funniest part of <KBD>make</KBD> (apart from
interpreting esoteric error messages). Basically, you have to specify
rules how a target depending on specifics source is created. For
<KBD>hsc</KBD>, the target is usually the html document, and the sources are
all those files with the <KBD>.hsc</KBD> extension needed to create
the document.</P>
<P>As it would be dull to tell <KBD>make</KBD> exactly what to do for every
single target, you can specify so called pattern rules, which tell
<KBD>make</KBD> how to generally handle whole groups of files.</P>
<P>Ancient versions of <KBD>make</KBD> often only support a rather impotent way
for such pattern rules. An example of such an outdated rule:</P>
<PRE>
.c.o:
$(CC) $(CFLAGS) -c $<
</PRE>
<P>The first line tells <KBD>make</KBD> that now a rule will follow how to
create a target with a ``<CODE>.o</CODE>'' extension from a file with a
``<CODE>.c</CODE>'' extension. You shouldn't bother too much about the
second line. The only thing you will have to know: You can forget
these kind of rules for <KBD>hsc</KBD>. They did a good job for the ridiculous
bunch of C-programmers and their ridiculous compilers, but they are
useless for everything more sophisticated. However, many <KBD>make</KBD>-tools
still only support such rules.</P>
The equivalent pattern rule in a more reasonable syntax look like
this:
<PRE>
%.o : %.c
$(CC) $(CFLAGS) -c $<
</PRE>
<P>This should give you a clue which sections of the manual of <KBD>make</KBD>
should be relevant for you. Within the next chapter, you will find
some remarks about how to write a <I>Makefile</I> for <KBD>hsc</KBD>, but there
probably still will be no way around at least giving a glimpse to the
manual of <KBD>make</KBD>.</P>
<H2>So Why Make?</H2>
<P>After reading the above, one might think no one uses <KBD>make</KBD> as long
there any alternative left. See, and there is the problem: If you want
to have something quite powerful and flexible, which is available for
most platforms and is freeware, there currently is no alternative.</P>
<P>If you know of any, tell me and I will kick the whole chapter about
<KBD>make</KBD> and <I>Makefile</I>s immediately.</P>
<H2>Where to Get Make</H2>
<P>See also the section about <A HREF="../related.html">Related Stuff</A> where to obtain the version
of <KBD>make</KBD> recommended for use with <KBD>hsc</KBD>.</P>
</BODY></HTML>
|