# Makefile.in for xgalaga
# $Id: Makefile.in,v 1.2 1998/04/12 08:10:46 mrogre Exp $

top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

.SUFFIXES:
.SUFFIXES: .c .o

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)
libdir = $(prefix)/lib
infodir = $(prefix)/info

@SET_MAKE@

SOUNDSRV = @SOUNDSERVER@
SOUNDOBJS = @SOUNDSERVER@.o
SOUNDSRCS = @SOUNDSERVER@.c

SOUNDDEFS = -DSOUNDSERVER=\"@prefix@/@SOUNDSERVER@\"

RM = rm -f
CC = @CC@
CFLAGS = -I. @CFLAGS@ @DEFS@ @X_CFLAGS@ -DXGALAGADIR=\"@prefix@/\" $(SOUNDDEFS)
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ @X_LIBS@ libsprite/libsprite.a
INSTALL = @INSTALL@

OBJS = main.o images.o data.o paths.o pathfile.o title.o explosions.o \
	score.o highscore.o prize.o sound.o nas_sound.o
SRCS = `echo $(OBJS) | sed -e 's/\.o/.c/g'`

TARGET = xgalaga

SUBDIRS = libsprite

all: $(TARGET) $(SOUNDSRV)

$(SOUNDSRV): $(SOUNDOBJS)
	$(CC) $(LDFLAGS) -o $(SOUNDSRV) $(SOUNDOBJS) $(SOUNDLIBS)

install: all
	mkinstalldirs $(bindir)
	$(INSTALL) $(TARGET) $(bindir)/$(TARGET)
	$(INSTALL) $(SOUNDSRV) $(prefix)/$(SOUNDSRV)
	mkinstalldirs $(prefix)/sounds
	mkinstalldirs $(prefix)/levels
	for i in levels/*.xgl; do $(INSTALL) $$i $(prefix)/$$i ; done
	for i in sounds/*.raw; do $(INSTALL) $$i $(prefix)/$$i ; done

subdirs:
	for i in $(SUBDIRS); do cd $$i ; make ; done

$(TARGET): subdirs $(OBJS)
	$(RM) $(TARGET)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

clean:
	$(RM) core *.o $(OBJS) $(TARGET)

dist: clean
	cd libsprite;make clean
	if test -d xgalaga-2.0 ; then echo -n; else  mkdir xgalaga-2.0; fi
	cp -rf $(SRCS) configure *.in *.sub *.guess images sounds xgal.sndsrv.*.c libsprite README* INSTALL CHANGES *.h install-sh *.xgl mkimgsrc* xgalaga-2.0
	cd xgalaga-2.0; rm -f config.h
	cd xgalaga-2.0/libsprite; make distclean ; rm -rf CVS
	find xgalaga-2.0 -name "CVS" -exec rm -rf {} \; -prune
	tar czvf xgalaga-2.0.tar.gz xgalaga-2.0

distclean: clean
	$(RM) Makefile config.h config.status config.cache config.log
	cd libsprite;$(MAKE) distclean

depend:
	makedepend $(CFLAGS) $(SRCS)