[comp.windows.x] imake disaster recovery

bin@primate.wisc.edu (Brain in Neutral) (07/19/90)

Here are some observations I have made when developing projects with
imake, related to Makefile trashing and how to recover.  Maybe they'll
be helpful to others...

Imake is wonderful for portability ***once everything is configured
properly***, but on the way to getting everything configured correctly,
subtle syntax errors may occur that are difficult to track down,
since the problem might be in any of Imakefile, Imake.rules,
Imake.tmpl, Project.tmpl, the platform .cf file, or site.def.

(1) Trashed Makefiles

A number of problems during "make Makefile" result a trashed Makefile.
The first thing that this step does is to move the original Makefile to
Makefile.bak, so if the new Makefile isn't created properly, you can
usually recover it with "cp Makefile.bak Makefile".  Then you can fix
the problem and try again.  If Makefile.bak is trashed as well, you can
grab the Makefile from another directory at the same level and use
that (this works because they all contain the same "make Makefile"
rule).  You can also use a Makefile from a directory at another level,
but you need to edit the line that sets TOP to reflect where the top
directory is in relation to the current directory.

Or you may be able to recover the Makefile with xmkmf.

(2) cpp: /usr/tmp/tmp-imake.nnnn:line mmmm: syntax error

This can occur if a symbol that needs to be #define'd as YES or NO is
simply #define'd (as nothing).  The symbol is probably in Imake.tmpl,
Project.tmpl, the platform .cf file, or site.def.  Define the symbol
properly and try again.

This problem can also occur if there is a "#if symbol" line in an Imakefile
that should really be "#ifdef symbol".

(3) make:  line nnn: syntax error

This can occur after "make Makefile", if a rule in Imake.rules is
#define'd with a space between the rule name and the argument list:

	#define rulename(arglist)               right
	#define rulename (arglist)              wrong!

When this happens, you'll usually see " (arglist)" on line nnn of the
Makefile, and "rulename" won't have been expanded properly.  Fix the rule
and try again.

Other similar errors can occur if rules are defined or used with spaces
anywhere between the end of the macro name to the closing parenthesis of
the argument list.  Particularly if macro arguments are used to create
the rule target name.

Paul DuBois
dubois@primate.wisc.edu