[comp.windows.x] Question on Imakefile

mikel@cadence.cadence.com (09/07/90)

I got a question on Imakefile.  In a directory I want to generate
multiple programs.  How can I pass different DEFINES or CFLAGS to 
each program generating rules?  I'm using SingleProgramTarget().

moraes@cs.toronto.edu (Mark Moraes) (09/07/90)

mikel@cadence.cadence.com writes:
>I got a question on Imakefile.  In a directory I want to generate
>multiple programs.  How can I pass different DEFINES or CFLAGS to 
>each program generating rules?  I'm using SingleProgramTarget().

Try one of the Special*ObjectRule() macros -- specify the objects to
be compiled with this rule, any special dependencies for those objects,
(ones that makedepend will not detect) and the options to give cc -c.
eg.

NormalProgramTarget(foo,foo.o x.o y.o,$(DEPLIBS),$(LOCAL_LIBRARIES),$(SYS_LIBRARIES))
SpecialObjectRule(foo.o,Makefile,-DFOO)

will essentially generate the Makefile:

foo: foo.o x.o y.o $(DEPLIBS)
	cc $(CFLAGS) -o $@ foo.o x.o y.o $(LOCAL_LIBRARIES) $(SYS_LIBRARIES)

foo.o: Makefile
	cc -c $(CFLAGS) -DFOO $*.c

[Note. Imake.rules indicates SingleProgramTarget is obsolete since it
 doesn't understand DEPLIBS]

People are strongly advised to read Imake.rules when working with
Imakefiles.  No, it isn't that complex if you understand cpp and make.
The R4 version is well documented, too. [Many thanks to whoever did
that]

	Mark.