[comp.windows.x] imake guide

david@lta.COM (David B. Lewis) (11/08/90)

Whatever happened to the fellow who over the summer made an offer to construct
a guide to using imake? The name "Paul Dubois" sounds right, but I no longer have
an email address. Such a guide might help douse the current hubbub.

If you're listening.... 

-- 
David B. Lewis  			Lewis, Trachtenberg & Associates (LTA)
					+1 617 225 0366
Note new address!:	david@lta.com 			(Real Soon Now)
			david@lta.UUCP			(Right Now)
			david%lta.uucp@uunet.uu.net	(Works for Now)

brossard@sasun1.epfl.ch (Alain Brossard EPFL-SIC/SII) (11/09/90)

	I wrote a man page for imakefiles to allow me to easily
modify existing Imakefiles.  It isn't complete but it does contain
a lot of usefull information.  It is included here with
no warranty :-) and I'll happily accept any patches for
improvment and/or corrections.  Who knows maybe it will
make it into X.V11R5...

				Alain Brossard
				brossard@sasun1.epfl.ch

PS	ContribRules and ComplexGameTarget are locally defined macros.

.TH IMAKEFILE 1 "Release 4" "X Version 11"
.SH NAME
imakefile \- used to generate Makefiles
.SH DESCRIPTION
This man page is incomplete!
.PP
This man page describes a few of the macros available
in Imakefiles.  Although they aren't documented, you
can also use
.I cpp
variables like
.I sun or
.I HasGcc,
check in the appropriate
.I .cf
file under
.I /sic/install_X11/X.V11R4/VRAIE_SOURCE/mit/config.
.PP
.nf
 *      NormalProgramTarget   (program,objects,deplibs,locallibs,syslibs)
.fi
will compile objects into program with the dependancies being objects and
deplibs, and the libraries being in locallibs and the system
libraries in syslibs.
.PP
.nf
 *      SingleProgramTarget            (program)
.fi
generate rules for compiling and linking programs
that only have one C source file.  It should only be used in Imakefiles
that describe a single program.
.PP
.nf
 *      ComplexProgramTarget           (program)
.fi
.I ComplexProgramTarget
- generate rules for compiling and linking the
program specified by $(OBJS) and $(SRCS), installing the program and its
man page, and generating dependencies.  It should only be used in
Imakefiles that describe a single program.
.PP
.nf
 *      ComplexGameTarget              (program)
.fi
.I ComplexGameTarget
- as above for games or demos.
.PP
.nf
 *      ComplexProgramTarget_1         (program,locallib,syslib)
.fi
.I ComplexProgramTarget_1
- generate rules for compiling and linking the
program specified by $(OBJS1) and $(SRCS1), installing the program and its
man page, and generating dependencies for it and any programs described
by $(SRCS2) and $(SRCS3).  It should be used to build the primary
program in Imakefiles that describe multiple programs.
.PP
.nf
 *      ComplexProgramTarget_2         (program,locallib,syslib)
.fi
.I ComplexProgramTarget_2
- generate rules for compiling and linking the
program specified by $(OBJS2) and $(SRCS2) and installing the program and
man page.  It should be used to build the second program in Imakefiles
describing more than one program.
.PP
.nf
 *      ComplexProgramTarget_3         (program,locallib,syslib)
.fi
.I ComplexProgramTarget_3
- generate rules for compiling and linking the
program specified by $(OBJS3) and $(SRCS3) and installing the program and
man page.  It should be used to build the third program in Imakefiles
describing more than one program.
.PP
.nf
 *      InstallLibrary                 (libname,dest)
.fi
.I InstallLibrary
- generate rules to install the indicated library
which should reside in a subdirectory called lib.
.PP
.nf
 *      InstallManPage                 (file,dest)
.fi
.I InstallManPage
- generate rules to install the indicated manual page.
.PP
.nf
 *      InstallProgram                 (program,dest)
.fi
.I InstallProgram
- generate rules to install an executable program using any
special install flags set in $(INSTALLFLAGS).
.PP
.nf
 *      InstallProgramWithFlags        (program,dest,flags)
.fi
.I InstallProgramWithFlags
- generate rules to install an executable program
using given install flags.
.PP
.nf
 *      NormalLibraryObjectRule        ()
.fi
.I NormalLibraryObjectRule
- generate make rules to build "normal" objects (.c.o rule).
.PP
.nf
 *      SpecialObjectRule              (objs,depends,options)
.fi
.I SpecialObjectRule
- generate rules to compile a file with special flags.
.PP
.nf
 *      NormalLibraryTarget            (libname,objlist)
.fi
.I NormalLibraryTarget
- generate rules to create a library believed to be in ./lib/libname.
.PP
.nf
 *      NormalLibraryTarget2           (libname,objlist1,objlist2)
.fi
.I NormalLibraryTarget2
- generate rules to create a library in two steps.
This is used to create libraries with large numbers of files.
.PP
.nf
 *      MakeSubdirs                    (dirs)
.fi
.I MakeSubdirs
- make all in the named sub directories.
.PP
.nf
 *      NamedMakeSubdirs               (name,dirs)
.fi
.I NamedMakeSubdirs
- generate rules (with the name "name") to do makes (all) in
the given subdirectories.
If you want a flag (eg: CDEBUGFLAGS) passed along to
subdirectories, provide a line like
the following in the appropriate Imakefile
.nf
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
.fi
.PP
.nf
 *      NamedTargetSubdirs             (name,dirs,verb,flags,subname)
.fi
.I NamedTargetSubdirs
- recursively make a series of steps with the rule
.I name
on the rule
.I subname
in the dirs.  The
.I verb
is used to provide feedback to the user and the
.I flags
are passed to make.
.PP
.nf
 *      DependSubdirs                  (dirs)
.fi
.I DependSubdirs
- generate rules to recursively compute dependencies as
part of the make depend step.
.PP
.nf
 *      InstallSubdirs                 (dirs)
.fi
.I InstallSubdirs
- generate rules to recursively install programs and files.
.PP
.nf
 *      InstallManSubdirs              (dirs)
.fi
.I InstallManSubdirs
- generate rules to recursively install manual pages.
.PP
.nf
 *      CleanSubdirs                   (dirs)
.fi
.I CleanSubdirs
- generate rules to recursively clean out garbage files.
.PP
.nf
 *      MakefileSubdirs                (dirs)
.fi
.I MakefileSubdirs
- generate rules to create Makefiles.
.PP
.nf
 *      MakeDirectories                (step,dirs)
.fi
.I MakeDirectories
- generate a rule called
.I step
to create a hierarchy of directories.
.PP
.nf
 *      InstallAppDefaults             (class)
.fi
.I InstallAppDefaults
- generate rules to install appliation default files
if the InstallAppDefFiles configuration parameter is set.
.PP
.nf
 *      AllTarget                      (depends)
.fi
.I AllTarget
- generate rules to build necessary things (depends) during make all.
.fi
.PP
.I IHaveSubdirs
is a rule which tells imake to  generate appropriate references
to allow recursive make into subdirectories defined in the
variable
.I SUBDIRS.
The rules generated are for install, installman, clean and makefiles.
.I PassCDebugFlags
should be defined to whatever flags one needs to pass
to the make command in the subdirectories or to be null
(eg: #define PassCDebugFlags ).  In order to also have a rule
for "all" and "depend" which will affect subdirectories, add
.I MakeSubdirs($(SUBDIRS))
and
.I DependSubdirs($(SUBDIRS)).
.PP
.nf
       ContribRules
.fi
.I ContribRules
changes the above rules to install in the special directories
for contribs.
.PP
The actual Makefile generated will have something like:
.nf
program: $(OBJS) $(DEPLIBS)
	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)

	for ComplexProgramTarget or

program: $(OBJS3) $(DEPLIBS3)
	$(CC) -o $@ $(LDOPTIONS) $(OBJS3) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS)
.fi
for
.I ComplexProgramTarget_3.
Note that the programmer can create the "make" variables:
CCOPTIONS (used in CFLAGS to go from .c to .o),
EXTRA_INCLUDES also used in CFLAGS,
DEFINES for cpp,
LOCAL_LIBRARIES to define local libraries.  To link with
the X11 libraries, define LOCAL_LIBRARIES to include one
or more of the following: $(XLIB) $(XAUTHLIB) $(XMULIB) $(XTOOLLIB) $(XAWLIB).
Or for to use the athena widgets, simply
.I XawClientLibs.
To define dependancies on system libraries, define
.I DEPLIBS
to be one of the following:
.I XawClientDepLibs
$(DEPXLIB) $(DEPXAUTHLIB) $(DEPEXTENSIONLIB) $(DEPXMULIB) $(DEPXTOOLLIB).
.SH EXAMPLE
.nf
   MAIN_DEFINES = -DUTMP
        DEFINES = -DZICONBEEP
          SRCS1 = button.c charproc.c cursor.c data.c input.c \
                  main.c menu.c misc.c screen.c scrollbar.c tabs.c \
                  TekPrsTbl.c Tekproc.c util.c VTPrsTbl.c
          OBJS1 = main.o input.o charproc.o cursor.o util.o tabs.o \
                  screen.o scrollbar.o button.o Tekproc.o misc.o \
                  VTPrsTbl.o TekPrsTbl.o data.o menu.o
          SRCS2 = resize.c
          OBJS2 = resize.o
           SRCS = $(SRCS1) $(SRCS2)
           OBJS = $(OBJS1) $(OBJS2)
       DEPLIBS1 = XawClientDepLibs
       DEPLIBS2 =
       PROGRAMS = resize xterm
#
# Define all the targets for the programs
AllTarget($(PROGRAMS))

# Add special object rules for some of the modules

SpecialObjectRule(main.o, ,$(MAIN_DEFINES))

# Rules to compile xterm

NormalProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),XawClientLibs, /**/)

# Rules to install xterm with the suid bit set

InstallProgramWithFlags(xterm, $(BINDIR), $(INSTUIDFLAGS))

NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2), , /**/)
InstallProgram(resize, $(BINDIR) )

# Rules to install the application defaults for xterm

InstallAppDefaults(XTerm)

InstallManPage(xterm,$(MANDIR))

# Generate the dependencies rules form "make depend"

DependTarget()
.SH "SEE ALSO"
imake(1)

bin@primate.wisc.edu (Brain in Neutral) (11/10/90)

From article <9011081410.AA16304@lta.com>, by david@lta.COM (David B. Lewis):
> Whatever happened to the fellow who over the summer made an offer to construct
> a guide to using imake? The name "Paul Dubois" sounds right, but I no longer have
> an email address. Such a guide might help douse the current hubbub.

I got buried under real work, sorry (as opposed to fun stuff like writing
documentation :-).  It's still sitting on my desk right here next to my
heart, er, my keyboard, that is.  I'll mention again that the current
version is still ftp-able from indri.primate.wisc.edu in ~ftp/imake-stuff/...

Paul DuBois
dubois@primate.wisc.edu