#ifndef XCOMM
#define XCOMM /**/#
#endif
XCOMM @(#)Imakefile
XCOMM
XCOMM Copyright 1994 - 2025  David A. Bagley, bagleyd AT verizon.net
XCOMM
XCOMM All Rights Reserved
XCOMM
XCOMM Permission to use, copy, modify, and distribute this software and
XCOMM its documentation for any purpose and without fee is hereby granted,
XCOMM provided that the above copyright notice appear in all copies and
XCOMM that both that copyright notice and this permission notice appear in
XCOMM supporting documentation, and that the name of the author not be
XCOMM used in advertising or publicity pertaining to distribution of the
XCOMM software without specific, written prior permission.
XCOMM
XCOMM This program is distributed in the hope that it will be "useful",
XCOMM but WITHOUT ANY WARRANTY; without even the implied warranty of
XCOMM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

XCOMM xpyraminx Imakefile for xmkmf (UNIX X11 support)

NAME = oct
WIDGET2 = $(WIDGET)2d
WIDGET = Oct
C=.c
O=.o
#O=.obj 
#O=.@OBJEXT@
E=
#E=.exe
#E=@EXEEXT@
P=x
A=X
R=$(P)
V=
GROUP = xpuzzles
PROG = $(R)$(NAME)
VER = $(V)$(NAME)

XCOMM CC = cc
XCOMM CC = acc
XCOMM CC = gcc -Wall
XCOMM CC = g++ -Wall

XCOMM   *** BEGIN XPM CONFIG SECTION ***

XCOMM If your system has libXpm (Xpm), remove the 'XCOMM ' from the next line.
XCOMM #define XpmLibrary

#ifdef XpmLibrary
XPMDEF = -DHAVE_XPM

XCOMM If you get an error "Cannot find xpm.h" while compiling, set
XCOMM XPMINC to the directory X11/xpm.h is in.  Below is a guess
XCOMM of the location of the XPM include directory.
XPMINC = -I/usr/local/include
XCOMM The SGI ViewKit has a link so the include is under X11 as well
XCOMM  XPMINC = -I/usr/include/Vk

XCOMM If you get an error "Cannot find libXpm" while linking, set the path
XCOMM to the directory libXpm.* is in.  Below is a guess of the
XCOMM location of the XPM library directory.
XPMLIB = -L/usr/local/lib -lXpm

#endif

XCOMM   *** END XPM CONFIG SECTION ***

XCOMM   *** BEGIN XM CONFIG SECTION ***

XCOMM If your system has libXm (Motif), remove the 'XCOMM ' from the next line.
XCOMM #define XmLibrary

#ifdef XmLibrary
XCOMM If its not with your X11 stuff you should set the following
XCOMM  MOTIFHOME = /usr/local
XCOMM  MOTIFHOME = /usr/dt

XCOMM If you get an error "Cannot find Xm/PanedW.h" while compiling, set
XCOMM XMINC to the directory Xm/PanedW.h is in.  Below is a guess
XCOMM of the location of the Motif include directory.
XCOMM  XMINC = -I$(MOTIFHOME)/include
XMDEF = -DHAVE_MOTIF

XCOMM If you get an error "Cannot find libXm" while linking, set the path
XCOMM to the directory libXm.* is in.  Below is a guess of the
XCOMM location of the Motif library directory.
XCOMM  XMLIB = -L$(MOTIFHOME)/lib -lXm
XMLIB = -lXm

XCOMM Debugging with editres
XCOMM  EDITRESDEF = -DUSE_XMU -DHAVE_EDITRES
XCOMM  EDITRESLIB = -lXmu
#endif

XCOMM   *** END XM CONFIG SECTION ***

XCOMM   *** BEGIN XAW CONFIG SECTION ***

XCOMM If your system has libXaw (Athena), remove the 'XCOMM ' from the next line.
XCOMM #define XawLibrary

#ifdef XawLibrary
XCOMM If its not with your X11 stuff you should set the following
XCOMM  ATHENAHOME = /usr/local

XCOMM If you get an error "Cannot find Xaw/Form.h" while compiling, set
XCOMM XAWINC to the directory Xaw/Form.h is in.  Below is a guess
XCOMM of the location of the Motif include directory.
XCOMM  XAWINC = -I$(ATHENAHOME)/include

XCOMM If you get an error "Cannot find libXaw" while linking, set the path
XCOMM to the directory libXaw.* is in.  Below is a guess of the
XCOMM location of the Athena library directory.
XCOMM  XAWLIB = -L$(ATHENAHOME)/lib -lXaw

XCOMM XAWDEF = -DHAVE_ATHENA -DHAVE_LIB_XAW3DXFT
XCOMM XAWLIB = -lXaw3dxft
XCOMM XAWDEF = -DHAVE_ATHENA -DHAVE_LIB_XAW3D
XCOMM XAWLIB = -lXaw3d
XCOMM XAWDEF = -DHAVE_ATHENA -DHAVE_LIB_NEXTAW
XCOMM XAWLIB = -lneXtaw
XCOMM XAWDEF = -DHAVE_ATHENA -DHAVE_LIB_XAWPLUS
XCOMM XAWLIB = -lXawPlus
XAWDEF = -DHAVE_ATHENA
XAWLIB = -lXaw
#endif

XCOMM Debugging with editres
XCOMM  EDITRESDEF = -DUSE_XMU
XCOMM  EDITRESLIB = -lXmu

XCOMM   *** END AW CONFIG SECTION ***

XCOMM   *** BEGIN OPENGL AND MESA CONFIG SECTION ***

XCOMM If your system has libGL (OpenGL or Mesa),
XCOMM remove the 'XCOMM ' from the next line.
XCOMM #define GLLibrary

#ifdef GLLibrary
GLDEF = -DHAVE_OPENGL

XCOMM If you get an error "Cannot find GL/gl.h" while compiling, set
XCOMM GLINC to the directory GL/gl.h is in.  Below is a guess.
GLINC = -I/usr/local/include

#ifdef SGIArchitecture
XCOMM GLDEF += -DglGenTextures=glGenTexturesEXT\
XCOMM  -DglDeleteTextures=glDeleteTexturesEXT\
XCOMM  -DglBindTexture=glBindTextureEXT
GLLIB = -lGL -lGLU -lgl
#else
XCOMM If you get an error "Cannot find libMesaGL" while linking, set the path
XCOMM to the directory libMesaGL.* is in.  Below is a guess.
GLLIB = -L/usr/local/lib -lGL -lm
XCOMM   GLLIB = -L/usr/local/lib -lMesaGL
#endif
#ifdef SunArchitecture
XCOMM with OGL1.1
GLDEF += -DSUN_OGL_NO_VERTEX_MACROS
#endif
XCOMM 3Dfx card
XCOMM  GLDEF += -DFX
XCOMM Threads
XCOMM  GLLIB += -lpthread
#endif

XCOMM   *** END OPENGL AND MESA CONFIG SECTION ***

XCOMM   *** BEGIN SOUND CONFIG SECTION ***

XCOMM if your system has these sound libraries, remove the 'XCOMM  '
XCOMM  #define RplayLibrary
XCOMM  #define NasLibrary

#ifdef RplayLibrary
SOUNDDEF = -DUSE_RPLAY
SOUNDINC = -I/usr/local/include
XCOMM SOUNDLIB = -L/share/lib -lrplay
SOUNDLIB = -L/usr/local/lib -lrplay
#endif

#ifdef NasLibrary
SOUNDDEF = -DUSE_NAS
SOUNDINC = -I/usr/X11R6/include
SOUNDLIB = -L/usr/X11R6/lib -laudio
#endif

XCOMM Set sound directory in XOct.ad

XCOMM  DEF_PLAY = "/usr/local/bin/play.sh"
XCOMM Uncomment line below if you have one of the above
XCOMM  SOUNDDEF = -DDEF_PLAY=\"$(DEF_PLAY)\"

XCOMM   *** END SOUND CONFIG SECTION ***

XCOMM   *** BEGIN RNG CONFIG SECTION ***

XCOMM Uncomment to use your system Random Number Generator
XCOMM They usually come in 3 types

XCOMM Uncomment to use high-precision (but expensive) RNG
XCOMM SRANDDEF = -DSRAND=srand48
XCOMM LRANDDEF = -DLRAND=lrand48

XCOMM SRANDDEF = -DSRAND=srandom
XCOMM LRANDDEF = -DLRAND=random

XCOMM Least desirable RNG
XCOMM SRANDDEF = -DSRAND=srand
XCOMM LRANDDEF = -DLRAND=rand

XCOMM Normally use the above with (default)
XCOMM MAXRANDDEF = -DMAXRAND=2147483648.0
XCOMM Use the following if using srand/rand and NOT AIXV3
XCOMM MAXRANDDEF = -DMAXRAND=32767.0
RANDDEF = $(SRANDDEF) $(LRANDDEF) $(MAXRANDDEF)

XCOMM   *** END RNG CONFIG SECTION ***

#ifdef SunArchitecture
#if SystemV4
EXTRA_LDOPTIONS = -R/usr/lib:/usr/openwin/lib

XCOMM Solaris may not have its own correct OSMinorVersion
XCOMM compare with uname -a, correct if wrong at /usr/openwin/lib/config/sun.cf
XCOMM If just using gcc, you may want to remove -xF references in sun.cf and
XCOMM Imake.tmpl if you get a
XCOMM cc: language F not recognized

#if OSMajorVersion > 5 || (OSMajorVersion == 5 && OSMinorVersion > 5)
       SLEEPDEF = -DHAVE_USLEEP=1
#else
XCOMM If SunOS 5.2 or less, do not have nanosleep
#if OSMajorVersion > 5 || (OSMajorVersion == 5 && OSMinorVersion > 2)
       SLEEPDEF = -DHAVE_NANOSLEEP=1
EXTRA_LIBRARIES += -lposix4 -lthread
#else
EXTRA_LIBRARIES = -lnsl -lposix4
#endif
#endif
#else
       SLEEPDEF = -DHAVE_USLEEP=1
#endif
#endif
#if defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || defined(i386BsdArchitecture)
       SLEEPDEF = -DHAVE_USLEEP=1
#endif
#if defined(LinuxArchitecture) || defined(cygwinArchitecture)
       SLEEPDEF = -DHAVE_USLEEP=1
#endif
XCOMM If AIX 3.1 or less
#if OSMajorVersion < 3 || (OSMajorVersion == 3 && OSMinorVersion < 2)
      SYSTEMDEF = -DLESS_THAN_AIX3_2
#endif

XCOMM Set your C compiler if necessary
XCOMM CC = gcc -g -DDEBUG -Wall
XCOMM CC = gcc -O

READPATH = /usr/local/share/games/$(GROUP)
XCOMM READPATH = /usr/share/games/$(GROUP)
SCOREPATH = /var/games/$(GROUP)
SCOREFILE = $(NAME).scores
LOGPATH = /usr/tmp
LOGFILE = $(NAME).log

DEFINES = -DHAVE_FCNTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 \
$(XMDEF) $(XAWDEF) $(XPMDEF) $(EDITRESDEF) \
$(GLDEF) $(SOUNDDEF) $(SLEEPDEF) $(RANDDEF) \
-DSOUNDPATH=\"$(READPATH)\" -DSOUNDEXT=\".au\" \
-DMOVESOUND=\"move\" \
-DSCOREPATH=\"$(SCOREPATH)\" -DSCOREFILE=\"$(SCOREFILE)\" \
-DLOGPATH=\"$(LOGPATH)\" -DLOGFILE=\"$(LOGFILE)\" \
$(XMINC) $(XAWINC) $(XPMINC) -DUSE_SPIN
LOCAL_LIBRARIES = $(XMLIB) $(XAWLIB) $(XTOOLLIB) $(XLIB) $(XPMLIB) \
$(EDITRESLIB)
# -lICE -lSM

COREHDRS = $(WIDGET)P.h \
$(WIDGET).h \
xwin.h \
file.h \
timer.h \
rngs.h \
sound.h \
version.h \
xgui.h \
pixmaps/check.xbm \
pixmaps/box.xbm \
pixmaps/up.xbm \
pixmaps/down.xbm \
pixmaps/64x64/$(NAME).xbm \
pixmaps/16x16/$(NAME).xpm \
pixmaps/22x22/$(NAME).xpm \
pixmaps/24x24/$(NAME).xpm \
pixmaps/32x32/$(NAME).xpm \
pixmaps/48x48/$(NAME).xpm \
pixmaps/64x64/$(NAME).xpm
HDRS = $(COREHDRS) \
$(WIDGET2)P.h \
$(WIDGET2).h \
$(WIDGET)GLP.h \
$(WIDGET)GL.h

COREOBJS = $(WIDGET)$(O) \
$(WIDGET)S$(O) \
$(WIDGET)U$(O) \
$(WIDGET)F$(O) \
$(WIDGET2)$(O) \
$(WIDGET)GL$(O)
UTILOBJS = xwin$(O) \
file$(O) \
timer$(O) \
rngs$(O) \
sound$(O) \
xgui$(O)
OBJS = $(UTILOBJS) \
$(COREOBJS) \
$(P)$(NAME)$(O)

CORESRCS = $(WIDGET)$(C) \
$(WIDGET)S$(C) \
$(WIDGET)U$(C) \
$(WIDGET)F$(C) \
$(WIDGET2)$(C) \
$(WIDGET)GL$(C)
UTILSRCS = xwin$(C) \
file$(C) \
timer$(C) \
rngs$(C) \
sound$(C) \
xgui$(C)
SRCS = $(UTILSRCS) \
$(CORESRCS) \
$(P)$(NAME)$(C)

ComplexProgramTarget($(PROG))
NormalProgramTarget($(PROG)$(E), $(OBJS), NullParameter, $(LOCAL_LIBRARIES), NullParameter)

$(WIDGET)$(O) : $(WIDGET)$(C) $(HDRS)
$(WIDGET)S$(O) : $(WIDGET)S$(C) $(WIDGET)P.h $(WIDGET).h rngs.h
$(WIDGET)U$(O) : $(WIDGET)U$(C) $(WIDGET)P.h $(WIDGET).h
$(WIDGET)F$(O) : $(WIDGET)F$(C) $(WIDGET)P.h $(WIDGET).h rngs.h
$(WIDGET2)$(O) : $(WIDGET2)$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET2)P.h $(WIDGET2).h xwin.h
$(WIDGET)GL$(O) : $(WIDGET)GL$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET)GLP.h $(WIDGET)GL.h
xwin$(O) : xwin$(C) xwin.h
file$(O) : file$(C) file.h
timer$(O) : timer$(C) timer.h
rngs$(O) : rngs$(C) rngs.h
sound$(O) : sound$(C) sound.h file.h
xgui$(O) : xgui$(C) xgui.h
$(P)$(NAME)$(O) : $(P)$(NAME)$(C) $(WIDGET).h \
xwin.h file.h version.h xgui.h

run :
	./$(PROG)

distclean::	clean
	$(RM) config.cache config.log $(PROG)-1.html $(PROG)._man
	rm -rf autom4te.cache
	cd win32 ; make -f Makefile distclean

clean.all::	distclean
	$(RM) Makefile config.status*
