#
#	ssystem 1.6 Makefile for gcc compiler (for egcs/pgcc use Makefile)
#
#       Remove -DLINUXJOY if your linux kernel doesn't support joysticks or
#       you're running other OS             
#
#       Even if you're running Linux, make sure your joystick driver is v1.x
#       I've tested it with the v1.2.13 included in the 2.2.1 kernel.

CC= gcc

# Your Mesa base directory
MESADIR=/root/Mesa-3.0

#ssystem data directory
SDATADIR=.

CFLAGS = -Wall -O3 -m486 -I$(MESADIR)/include -ffast-math -funroll-loops \
	 -fomit-frame-pointer -DLINUXJOY -DSDATADIR=\"$(SDATADIR)\"

LDFLAGS= -L/usr/X11R6/lib -L$(MESADIR)/lib -ljpeg -lglut -lMesaGLU -lMesaGL \
	  -lXext -lXmu -lX11 -lXi -lm

OBJ = cfgparse.tab.o lex.cfg.o ssystem.o init.o positions.o joystick.o \
        cmdline.o keyboard.o mouse.o scrnsht.o sun.o timer.o util.o astrolib.o \
        jpeg.o stars.o
 

LIBS = 

all: ssystem

clean:
	rm -f *.o *~ ssystem .depend cfgparse.tab.* cfgparse.output lex.cfg.c

ssystem: $(OBJ)
	$(CC) -o ssystem $(OBJ) $(LDFLAGS) $(LIBS) 

lex.cfg.c: cfglex.l cfgparse.tab.c
	flex -i -Pcfg cfglex.l

cfgparse.tab.c: cfgparse.y
	bison -d -v -p cfg cfgparse.y

.c.o:
	$(CC) -c $(CFLAGS) $< 

dep:
	gcc -MM -I/root/Mesa-3.0/include *.c > .depend

# DO NOT DELETE
astrolib.o: astrolib.c vsop87.dat
cfgparse.tab.o: cfgparse.tab.c ssystem.h
cmdline.o: cmdline.c ssystem.h cfgparse.tab.h
init.o: init.c ssystem.h cfgparse.tab.h
joystick.o: joystick.c ssystem.h cfgparse.tab.h
jpeg.o: jpeg.c ssystem.h cfgparse.tab.h
keyboard.o: keyboard.c ssystem.h cfgparse.tab.h
lex.cfg.o: lex.cfg.c ssystem.h cfgparse.tab.h
mouse.o: mouse.c ssystem.h cfgparse.tab.h
positions.o: positions.c ssystem.h cfgparse.tab.h
scrnsht.o: scrnsht.c ssystem.h cfgparse.tab.h
ssystem.o: ssystem.c ssystem.h cfgparse.tab.h
stars.o: stars.c ssystem.h cfgparse.tab.h
sun.o: sun.c ssystem.h cfgparse.tab.h
timer.o: timer.c ssystem.h cfgparse.tab.h
util.o: util.c ssystem.h cfgparse.tab.h
