####### General stuff

INCDIR	=	-I$(QTDIR)/include -I$(KDEDIR)/include
CFLAGS	=	-O2
LFLAGS	=	-L$(QTDIR)/lib -L$(KDEDIR)/lib -lqt -lkdecore -lX11 -ldl
CC	=	gcc
MOC	=	moc

####### Files

SOURCES =	t1.tab.c lex.yy.c cpp2bison.cpp jstree.cpp jsexec.cpp builtin.cpp
HEADERS =	t1.tab.h bison2cpp.h jstree.h jsexec.h jserror.h builtin.h
OBJECTS =	t1.tab.o lex.yy.o cpp2bison.o jstree.o jsexec.o builtin.o
SRCMETA =	
TARGET	=	libjscript.so.$(SOMAJOR).$(SOMINOR)

####### Library version

SOREV 	=	1.0.0
SOMAJOR = 	1
SOMINOR = 	0
SOPATCH =	0	

####### Install

INSTALL = install -m 0755 -s
INSTALL_SHELL = install -m 0755
INSTALL_DATA = install -m 0644
INSTALL_DIR = install -d -m 0755
INSTALL_DIR_PRIVATE = install -d -m 0700

####### Implicit rules

.SUFFIXES: .cpp

.cpp.o:
	$(CC) -c $(CFLAGS) -DSTDC_HEADERS -DHAVE_UNISTD_H $(INCDIR) -fPIC $<
.c.o:
	$(CC) -c $(CFLAGS) -I$(INCDIR) -fPIC $<

####### Build rules

all: $(TARGET)

$(TARGET): $(SRCMETA) $(OBJECTS)
	rm -f $@
	$(CC) -shared -Wl,-soname,$(TARGET) -o $@ $(OBJECTS) $(LFLAGS)

depend:
	@makedepend -I$(INCDIR) $(SOURCES) 2> /dev/null

showfiles:
	@echo $(SOURCES) $(HEADERS) Makefile

clean:
	-rm -f *.o *.bak *~ *% #*
	-rm -f $(SRCMETA) $(TARGET)

install:
	$(INSTALL_DIR) $(KDEDIR)/lib
	$(INSTALL_DIR) $(KDEDIR)/include
	$(INSTALL_DATA) jsexec.h $(KDEDIR)/include
	$(INSTALL_DATA) jstree.h $(KDEDIR)/include
	$(INSTALL_DATA) jserror.h $(KDEDIR)/include
	rm -f $(KDEDIR)/lib/libjscript.so*
	$(INSTALL_DATA) libjscript* $(KDEDIR)/lib
	ln -s $(KDEDIR)/lib/$(TARGET) $(KDEDIR)/lib/libjscript.so.$(SOMAJOR)
	ln -s $(KDEDIR)/lib/$(TARGET) $(KDEDIR)/lib/libjscript.so

parser:
	bison -d t1.y
	flex t1.l

####### Meta objects


# DO NOT DELETE THIS LINE -- make depend depends on it.



