XCOMM =====================================================================
XCOMM Imakefile - XGalaga v1.2 - ogre@netcom.com - May 12, 1995
XCOMM =====================================================================

XCOMM This is the only line you should have to change.  the high scores
XCOMM file will be written in this directory, change SCOREFILE to put
XCOMM it somewhere else or change the name.  The sounds directory and
XCOMM sound server executable also reside here if sound is supported on
XCOMM your system.  If not doing "make install", set this to where the
XCOMM files are now.

    XGALAGADIR = /usr/games/xgalaga

    SCOREFILE    	= $(XGALAGADIR)/.xgalscores
    SOUNDDIR		= $(XGALAGADIR)/sounds

XCOMM Should be defined automatically for appropriate systems
XCOMM #define SOUND

XCOMM You should not have to change IMAGEDIR unless you rerun
XCOMM mkimgsrc and set it to not compile images in.  IE
XCOMM don't mess with this unless you know what it does.

    IMAGEDIR            = $(XGALAGADIR)/images

XCOMM You can get libXpm from ftp.x.org.  If it is already installed
XCOMM with the standard X libs, you shouldn't need to change this.
XCOMM otherwise make these point at wherever you put it.

    XPMLIB 		= -lXpm
    XPMINCLUDE 		= -I/usr/include/X11

XCOMM **** System specific preprocessor flags.  If yours isn't here,
XCOMM **** and you need something changed, tell me about it!

#if defined(LinuxArchitecture)
#define SOUND
    SYSDEFS = 
    SOUNDSERVER = xgal.sndsrv.linux
    SOUNDOBJS = sound.o
    SOUNDDEV = /dev/dsp
#endif

#if defined(AIXArchitecture)
    SYSDEFS = 
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(HPArchitecture)
    SYSDEFS = -DUSE_LRAND48  -ansi
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(SunArchitecture)
    SYSDEFS =
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(UltrixArchitecture)
    SYSDEFS = 
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(SGIArchitecture)
    SYSDEFS = 
    SOUNDSERVER =
    SOUNDOBJS =
#endif

#if defined(FreeBSDArchitecture)
#define SOUND
SYSDEFS = 
SOUNDSERVER = xgal.sndsrv.freebsd
SOUNDOBJS = sound.o
SOUNDDEV = /dev/dsp
#endif

XCOMM ***********************************************************
XCOMM ---> You shouldn't need to change anything below this <----
XCOMM ***********************************************************

    EXTRA_INCLS = $(XPMINCLUDE) 

#ifndef SOUND
    DEFINES = $(EXTRA_INCLS) $(SYSDEFS)\
        -DSCOREFILE=\"$(SCOREFILE)\" \
	-DIMAGEDIR=\"$(IMAGEDIR)\"
#else
    INSTALLSOUND = True

    DEFINES = $(EXTRA_INCLS) $(SYSDEFS) -DSOUND \
	-DSCOREFILE=\"$(SCOREFILE)\" \
	-DIMAGEDIR=\"$(IMAGEDIR)\" \
	-DSOUNDSERVER=\"$(XGALAGADIR)/$(SOUNDSERVER)\" \
	-DSOUNDDIR=\"$(SOUNDDIR)\" \
	-DSOUNDDEV=\"$(SOUNDDEV)\"
#endif

    LOCAL_LIBRARIES = $(XPMLIB) $(XLIB) -lm

    DEPLIBS = $(DEPXLIB)

    OBJS1 = main.o x11window.o images.o data.o paths.o title.o \
	explosions.o score.o highscore.o prize.o $(SOUNDOBJS)
    SRCS1 = `echo $(OBJS1) | sed -e 's/\.o/.c/g'`

    PROGRAMS = xgal

ComplexProgramTarget_1($(PROGRAMS), $(LOCAL_LIBRARIES), )

NormalProgramTarget($(SOUNDSERVER), $(SOUNDSERVER).o,,,)

install:: $(PROGRAMS) $(SOUNDSERVER)
	@echo "XGalaga directory is " $(XGALAGADIR)
	@:
	@echo "Creating directory " $(XGALAGADIR)
	@if [ ! -d $(XGALAGADIR) ]; then mkdir $(XGALAGADIR); fi
	@echo "Making an empty high score file"
	@touch $(SCOREFILE)
	@chmod a+rw $(SCOREFILE)
	@:
	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
	 then								\
		echo "Creating directory " $(SOUNDDIR); 		\
		if [ ! -d $(SOUNDDIR) ]; then mkdir $(SOUNDDIR); fi;    \
		echo "Copying sound server to directory " $(SOUNDDIR); \
		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(XGALAGADIR); \
		echo "Copying sound files into directory " $(SOUNDDIR); \
		cd ./sounds; set -x; for file in *.raw; do		\
		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(SOUNDDIR);	\
		done;   						\
	 fi

all:: $(SOUNDSERVER)

dist:
	@make clean
	@rm -f $(EXE) TAGS core
	@makedepend
	@:
	cd .. ; tar czvf $(PROGRAMS).tar.gz $(PROGRAMS)/

proto:
	@cproto $(CDEFS) $(INCLUDEDIRS) $(SRCS) > proto.h
