/***************************************************************************
 * Fvwm Imake template
 *
 * Edit this file to change compile time defaults and options
 ***************************************************************************/

#ifndef XCOMM
#define XCOMM #
#endif

XCOMM Fvwm.tmpl
XCOMM Template file for Fvwm

/***************************************************************************
 * #define RenameFVWM2
 *
 * If you want to install both fvwm 1.xx and fvwm 2.xx concurently, specify
 * #define RenameFVWM2. Otherwise, comment out the following line.
 * This will affect the name of the "fvwm" binary, library, and manual.
 *
 * I HIGHLY RECOMMEND THAT YOU LEAVE THIS DEFINED, TO AVOID CONFUSION!!!!
 ***************************************************************************/
#define RenameFVWM2


/***************************************************************************
 * #define FvwmCompiler
 * #define FvwmCompilerFlags
 *
 * To force a certain compiler and/or flags to be used to compile Fvwm.
 * Commonly used to force gcc to be used instead of your normal compiler
 * and/or flags that Imake would use.  If your Imake setup is ok, you
 * shouldn't need to set these.
 ***************************************************************************/
/* #define FvwmCompiler gcc */
/* #define FvwmCompilerFlags -g -Wall */


/***************************************************************************
 * Where to search for the fvwm icons.
 *
 * Define this if you want a different search path from the default which is
 * the `bitmaps' and `pixmaps' directories beneath the X include directory.
 *
 * Note that you have to escape the ':' with a '\' otherwise make gets
 * confused, and make sure you don't have any spaces in there.
 ***************************************************************************/

/* #define FvwmIconPath /usr/include/X11/bitmaps\:/usr/include/X11/pixmaps */


/***************************************************************************
 * #define HasXpm
 *
 * If you want color icons, define HasXpm as YES, and get libXpm from
 * sunsite.unc.edu (precompiled for Linux), or the source from
 * ftp.x.org.  If you want more color icons in addition to the ones
 * included in the fvwm package, check out the ctwm distribution,
 * which has lots of nice color icons.
 *
 * For monochrome, Xpm icons still work, but they're only better than regular
 * bitmaps because they're shaped (if you specify #define SHAPE).
 *
 * If Xpm is not installed with the rest of your X, set XpmLibs and
 * XpmIncs to the paths where the library and include files are located.
 ***************************************************************************/
#define HasXpm  YES     /* NO */
/* #define XpmLibs -L/usr/local/lib */
/* #define XpmIncs -I/usr/local/include */


/***************************************************************************
 * #define HasRPlay
 *
 * To add builtin support for the rplay library.  Also make sure that the 
 * include and lib settings are correct for your rplay installation.
 * This currently only effects the FvwmAudio module.
 ***************************************************************************/
#define HasRPlay NO     /* YES */
#define AudioLibs -L/usr/local/lib
#define AudioIncs -I/usr/local/include


/**************************************************************************
 * InstallSample
 *
 * Set this to NO If you would not like sample.fvwmrc/system.fvwmrc to be
 * installed.
 * You probably want this if you have a modified FVWMDIR/FVWMRC. 
 *************************************************************************/
#define InstallSample YES


/**************************************************************************
 * InstallUtils
 *
 * Set this to YES if you would like the programs in the utils directory
 * installed.
 *************************************************************************/
#define InstallUtils NO


/**************************************************************************
 * InstallLibs
 *
 * Set this to YES if you would like libfvwm2.a to be installed.
 *************************************************************************/
#define InstallLibs NO


/**************************************************************************
 *
 * OPTION_DEFINES
 *
 * Pick and mix your desired options from this list and add them to
 * OPTIONS_DEFINES below:
 *
 *
 * -DMODALITY_IS_EVIL
 *
 * Totally disables motif applications ability to have modal dialogs.
 * Use with care.
 *
 *
 * -DNO_SAVEUNDERS 
 *
 * Tells the WM not to request save unders for pop-up
 * menus. A quick test using monochrome X11 shows that save
 * unders cost about 4Kbytes RAM, but saves a lot of
 * window redraws if you have windows that take a while
 * to refresh. For xcolor, I assume the cost is more like
 * 4Kbytesx8 = 32kbytes (256 color).
 *
 *
 * -DSHAPE
 *
 * If you want the Shaped window extensions.
 * Shaped window extensions seem to increase the window managers RSS
 * by about 60 Kbytes. They provide for leaving a title-bar on the window
 * without a border.
 * If you don't use shaped window extension, you can either make your 
 * shaped windows undecorated, or live with a border and backdrop around
 * all your shaped windows (oclock, xeyes)
 *
 * If you normally use a shaped window (xeyes or oclock), you might as
 * well compile this extension in, since the memory cost is  minimal in
 * this case (The shaped window shared libs will be loaded anyway). If you
 * don't normally use a shaped window, you have to decide for yourself.
 *
 * Note: if it is compiled in, run time detection is used to make sure that
 * the currently running X server supports it.
 *
 *
 * -DACTIVEDOWN_BTNS
 *
 * Enables the ActiveDown button state.  This allows different button
 * styles for pressed down buttons on active windows (also for the
 * title-bar if EXTENDED_TITLESTYLE is enabled below).  The man page
 * refers to this button state as "ActiveDown."  If not defined, the
 * "ActiveUp" state is used instead.  Disabling this reduces memory
 * usage.
 * 
 *
 * -DINACTIVE_BTNS
 *
 * Enables the Inactive button state.  This allows different button
 * styles for inactive windows (also for the title-bar if
 * EXTENDED_TITLESTYLE is enabled below).  The man page refers to this
 * button state as "Inactive."  If not defined, the "ActiveUp" state
 * is used instead.  Disabling this reduces memory usage.
 * 
 *
 * -DMINI_ICONS
 *
 * Enables the "MiniIcon" Style option to specify a small pixmap which
 * can be used as one of the title-bar buttons, shown in window list,
 * utilized by modules, etc.  Requires PIXMAP_BUTTONS to be defined
 * (see below).
 *
 *
 * -DVECTOR_BUTTONS
 *
 * Enables the vector button style.  This button type is considered
 * "standard," so it is recommended that you leave it in.
 * 
 * 
 * -DPIXMAP_BUTTONS
 *
 * Enables the pixmap button style.  You must have Xpm support to use
 * color pixmaps.  See the man page button style entries for "Pixmap"
 * and "TiledPixmap" for usage information.
 *
 *
 * -DGRADIENT_BUTTONS
 *
 * Enables the gradient button style.  See the man page button style
 * entries for "HGradient" and "VGradient" for usage information.
 *
 *
 * -DMULTISTYLE
 *
 * Enables stacked button styles (also for the title-bar if
 * EXTENDED_TITLESTYLE is enabled below).  There is a slight memory
 * penalty for each additional style. See the man page entries for
 * AddButtonStyle and AddTitleStyle for usage information.
 *
 * 
 * -DEXTENDED_TITLESTYLE
 * 
 * Enables styled title-bars (specified with the TitleStyle command in
 * a similar fashion to the ButtonStyle command).  It also compiles in
 * support to change the title-bar height.
 *
 *
 * -DBORDERSTYLE
 *
 * Enables the BorderStyle command.  Not all button styles are
 * available.  See the man page entry for BorderStyle for usage
 * information.  If you are also using PIXMAP_BUTTONS, you can also
 * texture your borders with tiled pixmaps.  The BorderStyle command
 * has Active and Inactive states, regardless of the -DACTIVEDOWN_BTNS
 * and -DINACTIVE_BTNS defines.
 *
 *
 * -DUSEDECOR
 *
 * Enables tagged general decoration styles which can be assigned to
 * windows using the UseDecor Style option, or dynamically updated
 * with ChangeDecor.  To create and destroy "decor" definitions, see
 * the man page entries for AddToDecor and DestroyDecor.  There is a
 * slight memory penalty for each additionally defined decor.
 * 
 *
 * -DWINDOWSHADE
 *
 * Enables the WindowShade function.  This function "rolls" the window
 * up so only the title-bar remains.  See the man page entry for
 * "WindowShade" for more information.
 *
 ***************************************************************************/

/* 
** note - not all build environments like the '+=' useage below, so if you
**        want to use it, change the following #if 0 to #if 1
*/

#if 0

/* the works: */
OPTION_DEFINES  = -DSHAPE
OPTION_DEFINES += -DACTIVEDOWN_BTNS -DINACTIVE_BTNS -DMINI_ICONS
OPTION_DEFINES += -DVECTOR_BUTTONS -DPIXMAP_BUTTONS -DGRADIENT_BUTTONS
OPTION_DEFINES += -DMULTISTYLE -DEXTENDED_TITLESTYLE
OPTION_DEFINES += -DBORDERSTYLE -DUSEDECOR -DWINDOWSHADE

#else

/* the works, not using '+=': */
OPTION_DEFINES  = -DSHAPE -DACTIVEDOWN_BTNS -DINACTIVE_BTNS -DMINI_ICONS -DVECTOR_BUTTONS -DPIXMAP_BUTTONS -DGRADIENT_BUTTONS -DMULTISTYLE -DEXTENDED_TITLESTYLE -DBORDERSTYLE -DUSEDECOR -DWINDOWSHADE

#endif

/* Or if you prefer a more minimal setup, you could try something like: */
/* OPTION_DEFINES = -DSHAPE -DVECTOR_BUTTONS */


/***************************************************************************
 * The following section only needs to be changed if you do not want
 * Imake's default behaviour. 
 * Uncomment and edit to suit your requirements.
 ***************************************************************************/

/* Where do you want the fvwm binaries installed. */
/* #define FvwmBinDir /usr/local/X11R6/bin */

/* Where do you want the fvwm modules installed. */
/* #define FvwmDir /usr/local/X11R6/lib/X11/fvwm2 */

/* Where do you want the fvwm libraries installed. */
/* #define FvwmLibDir /usr/local/X11R6/lib */

/* Where do you want the fvwm man pages installed. */
/* #define FvwmManPath /usr/local/X11R6/man */
/* #define FvwmManSuffix 1 */


/***************************************************************************
 ***************************************************************************
 ***************************************************************************
   End of user configuration items.  You shouldn't need to edit below here.
 ***************************************************************************
 ***************************************************************************
 ***************************************************************************/

/*
** FvwmName is the name of the module
** FvwmRc is the name of the rc file to read by default
*/

#ifdef RenameFVWM2
#define FvwmName fvwm2
#define FvwmRc .fvwm2rc
#else
#define FvwmName fvwm
#define FvwmRc .fvwmrc
#endif /* RenameFVWM2 */


#ifndef HasXpm
#define HasXpm NO
#endif
#ifndef HasRPlay
#define HasRPlay NO
#endif
#ifndef InstallLibs
#define InstallLibs NO
#endif
#ifndef InstallUtils
#define InstallUtils NO
#endif
#ifndef InstallSample
#define InstallSample NO
#endif
#ifndef XpmIncs
#define XpmIncs /* as nothing */
#endif
#ifndef XpmLibs
#define XpmLibs /* as nothing */
#endif
#ifndef AudioIncs
#define AudioIncs /* as nothing */
#endif
#ifndef AudioLibs
#define AudioLibs /* as nothing */
#endif

#if HasXpm
    XPM_DEFINES = -DXPM
   XPM_INCLUDES = XpmIncs
  XPM_LIBRARIES = XpmLibs -lXpm
#endif


#if HasRPlay
    AUDIO_DEFINES = -DHAVE_RPLAY
   AUDIO_INCLUDES = AudioIncs
  AUDIO_LIBRARIES = AudioLibs -lrplay
#endif

#ifdef FvwmCompiler
        CC = FvwmCompiler
#endif
#ifdef FvwmCompilerFlags
XCOMM   CFLAGS = FvwmCompilerFlags
XCOMM   CCOPTIONS = FvwmCompilerFlags /* should I have another var for this? */
        CDEBUGFLAGS = FvwmCompilerFlags
#endif

#ifdef FvwmBinDir
        FVWMBINDIR = FvwmBinDir
#else
        FVWMBINDIR = $(BINDIR)
#endif

#ifdef FvwmLibDir
        FVWMLIBDIR = FvwmLibDir
#else
        FVWMLIBDIR = $(USRLIBDIR)
#endif

#ifdef FvwmManPath
        MANPATH = FvwmManPath
#endif

#ifdef FvwmManSuffix
        MANSUFFIX = FvwmManSuffix
#endif

#ifdef FvwmDir
        FVWMDIR = FvwmDir
#else
        FVWMDIR = $(LIBDIR)/FvwmName
#endif

#ifndef FvwmIconPath
#define FvwmIconPath $(INCDIR)/bitmaps\:$(INCDIR)/pixmaps
#endif

   ICONPATH = FvwmIconPath
     FVWMRC = FvwmRc
        LIB = FvwmName

/* take care of libs not correctly added by Imake on some systems */
/* #ifdef AlphaArchitecture */
#if defined(AlphaArchitecture) && !defined(linux)
KLUDGE_LIBS = -ldnet_stub
#else
#ifdef HPArchitecture
KLUDGE_LIBS = -lV3
#else
#ifdef i386SVR4Architecture
KLUDGE_LIBS = -lnsl -lsocket
#else /* all other systems shouldn't need anything */
KLUDGE_LIBS = 
#endif /* i386SVR4Architecture */
#endif /* HPArchitecture */
#endif /* AlphaArchitecture */

XCOMM  FVWM_LIBS = -L$(FVWM_SRCDIR)/libs -l$(LIB) $(XPM_LIBRARIES) $(KLUDGE_LIBS)
  FVWM_LIBS = $(FVWM_SRCDIR)/libs/lib$(LIB).a $(XPM_LIBRARIES) $(KLUDGE_LIBS)
FVWM_DEPLIB = $(FVWM_SRCDIR)/libs/lib$(LIB).a

    DEFINES = $(OPTION_DEFINES) $(XPM_DEFINES) $(AUDIO_DEFINES)
   INCLUDES = $(XPM_INCLUDES) $(AUDIO_INCLUDES) -I. -I$(FVWM_SRCDIR)/libs
    DEPLIBS = $(DEPXLIB) $(FVWM_DEPLIB)

   LINTLIBS = $(LINTXLIB)



/***************************************************************************
 * 
 *      Special rules for Fvwm
 * 
 **************************************************************************/

#ifndef InstallNamedNonExec
#define InstallNamedNonExec(what,as,where) InstallNonExec(what,where/as)
#endif /* InstallNamedNonExec() */

#ifndef InstallNonExecFile
#define InstallNonExecFile(file,dest) InstallNonExec(file,dest)
#endif /* InstallNonExecFile() */

#ifndef NullMake
#define NullMake()							@@\
all::									@@\
	@echo "make in $(CURRENT_DIR) done"
#endif /* NullMake */

#ifndef InstallExecTarget
#define InstallExecTarget(file,destdir)					@@\
install:: file								@@\
	$(INSTALL) -c $(INSTBINFLAGS) file $(DESTDIR)destdir
#endif /* InstallExecTarget */



/*
 * FvwmModuleTarget - 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.
 */
#ifndef FvwmModuleTarget
#define	FvwmModuleTarget(program)					@@\
        PROGRAM = program						@@\
									@@\
AllTarget(program)							@@\
									@@\
program: $(OBJS) $(DEPLIBS)						@@\
	RemoveTargetProgram($@)						@@\
	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@\
									@@\
InstallProgram(program,$(FVWMDIR))					@@\
InstallManPage(program,$(MANDIR))					@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	$(RM) $(PROGRAM)
#endif /* FvwmModuleTarget */

/*
 * FvwmProgramTarget - 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.
 */
#ifndef FvwmProgramTarget
#define	FvwmProgramTarget(program)					@@\
        PROGRAM = program						@@\
									@@\
AllTarget(program)							@@\
									@@\
program: $(OBJS) $(DEPLIBS)						@@\
	RemoveTargetProgram($@)						@@\
	$(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@\
									@@\
InstallProgram(program,$(FVWMBINDIR))					@@\
InstallManPage(program,$(MANDIR))					@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	$(RM) $(PROGRAM)
#endif /* FvwmProgramTarget */

#if ProjectX > 5

#ifndef FvwmCplusplusProgramTargetHelper
#if defined(i386BsdArchitecture) && defined(i386Bsdi)
        C++FLAGS = $(CXXFLAGS)
#endif
#define	FvwmCplusplusProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
ProgramTargetName(program): $(objs) $(deplib)				@@\
	RemoveTargetProgram($@)						@@\
	CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
									@@\
CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib)		@@\
SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
									@@\
InstallProgram(program,$(FVWMDIR))					@@\
InstallManPage(program,$(MANDIR))
#endif /* FvwmCplusplusProgramTargetHelper */

#ifndef FvwmComplexCplusplusProgramTarget
#define	FvwmComplexCplusplusProgramTarget(program)			@@\
        PROGRAM = program						@@\
									@@\
AllTarget(program)							@@\
									@@\
FvwmCplusplusProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
									@@\
DependTarget()								@@\
LintTarget()								@@\
									@@\
clean::									@@\
	RemoveFile(ProgramTargetName(program))
#endif /* FvwmComplexCplusplusProgramTarget */

#endif /* ProjectX > 5 */

#if defined(AIXArchitecture)
/* to get around a little bug in the AIX 4.1 Imake.rules */
#undef NamedMakeSubdirs
#define NamedMakeSubdirs(name,dirs) \
NamedTargetSubdirs(name,dirs,"Making" name,PassCDebugFlags,all)
#endif /* AIXArchitecture */

