JDK_HOME = /usr/lib/jdk1.4.2
MESA_HOME = /usr/X11R6

LIB_NAME = JunGL
TARGET = lib$(LIB_NAME).so
VERSION = 2.0

CC = gcc
CFLAGS = -Wall -O -fPIC -I$(MESA_HOME)/include \
	-I$(JDK_HOME)/include -I$(JDK_HOME)/include/linux
LD = gcc -shared -Wl,-soname,$(TARGET).$(VERSION)
LIBS = -L$(MESA_HOME)/lib -lGL -lGLU -L/usr/X11R6/lib -lX11 -lXext -lm
OBJS = procedures-gl.o procedures-glu.o glj-x11.o

DEST=/usr

all:	$(TARGET)

$(TARGET):	$(OBJS)
	$(LD) -o $(TARGET).$(VERSION) $(OBJS) $(LIBS)
	rm -f $(TARGET)
	ln -s $(TARGET).$(VERSION) $(TARGET)

install:
	rm -f $(DEST)/lib/$(TARGET).$(VERSION)
	cp -a $(TARGET).$(VERSION) $(DEST)/lib
	chown root.root $(DEST)/lib/$(TARGET).$(VERSION)
	rm -f $(DEST)/lib/$(TARGET)
	cd $(DEST)/lib ; ln -s $(TARGET).$(VERSION) $(TARGET)

clean:
	rm -f *.o *.so *.so.* *.la *.lo

procedures-gl.o:	jp_co_sra_gl4jun_GLjInterface.h
procedures-glu.o:	jp_co_sra_gl4jun_GLjInterface.h
glj-x11.o:	jp_co_sra_gl4jun_GLjInterface.h rendering_mode.h version.h
