#############################################################################
# Makefile for building moc
# Generated by tmake at 23:12, 1998/10/01
#     Project: moc
#    Template: moc.t
#############################################################################

####### System-dependendant options

####### BEGIN
#
#   This section was automatically generated from
#      /usr/local/qt-1.41/Makefile for building on
#       on Sat Oct  3 22:58:33 CDT 1998
#

# Compiling
SYSCONF_CC		= g++

# Compiling with support libraries
SYSCONF_CFLAGS_X11	= -I/usr/X11R6/include
SYSCONF_CFLAGS_QT	= -I$(QTDIR)/include
SYSCONF_CFLAGS_OPENGL	= -I/usr/X11R6/include

# Compiline YACC output
SYSCONF_CFLAGS_YACC     = -Wno-unused -Wno-parentheses

# Linking with support libraries
# X11
SYSCONF_LFLAGS_X11	= -L/usr/X11R6/lib
SYSCONF_LIBS_X11	= -lX11 -lXext
# Qt, Qt+OpenGL
SYSCONF_LFLAGS_QT	= -L$(QTDIR)/lib
SYSCONF_LIBS_QT		= -lqt
SYSCONF_LIBS_QT_OPENGL	= -lqgl
# OpenGL
SYSCONF_LFLAGS_OPENGL	= -L/usr/X11R6/lib
SYSCONF_LIBS_OPENGL	= -lMesaGL -lMesaGLU -lXmu -lXext -lm

# Linking applications
SYSCONF_LINK		= g++
SYSCONF_LFLAGS		= 
SYSCONF_LIBS		= 

# Link flags shared objects
SYSCONF_LFLAGS_SHOBJ	= -shared

# Meta-object compiler
SYSCONF_MOC		= $(QTDIR)/bin/moc

# Linking shared libraries
#   - Build the $(TARGET) library, eg. lib$(TARGET).so.0.0
#   - Place target in $(DESTDIR) - which has a trailing /
#   - Usually needs to incorporate $(VER_MAJ) and $(VER_MIN)
#
SYSCONF_LINK_SHLIB	= g++
SYSCONF_LINK_TARGET_SHARED	= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN)
SYSCONF_LINK_LIB_SHARED	=  $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \
				     $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \
				     $(OBJECTS) $(OBJMOC) $(LIBS); \
				 mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \
				 cd $(DESTDIR); \
				 rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ); \
				 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \
				 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ)

# Linking static libraries
#   - Build the $(TARGET) library, eg. lib$(TARGET).a
#   - Place target in $(DESTDIR) - which has a trailing /
#
SYSCONF_AR		= ar cqs
SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a
SYSCONF_LINK_LIB_STATIC	= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC);  \
				 $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC)
# Compiling application source
SYSCONF_CFLAGS		= -pipe -O2 -fno-strength-reduce
# Compiling library source
SYSCONF_CFLAGS_LIB	= -O2 -fno-strength-reduce -fPIC
# Compiling shared-object source
SYSCONF_CFLAGS_SHOBJ	= -O2 -fno-strength-reduce -fPIC
# Default link type (stati linking is still be used where required)
SYSCONF_LINK_LIB	= $(SYSCONF_LINK_LIB_SHARED)
SYSCONF_LINK_TARGET	= $(SYSCONF_LINK_TARGET_SHARED)

####### End of automatically generated section
####### END

####### Compiler, tools and options

CC	=	$(SYSCONF_CC)
CFLAGS	=	$(SYSCONF_CFLAGS_QT) $(SYSCONF_CFLAGS_YACC) $(SYSCONF_CFLAGS)
LFLAGS	=	$(SYSCONF_LFLAGS)
LIBS	=	$(SYSCONF_LIBS)
MOC	=	$(SYSCONF_MOC)

####### Target

TARGET	= moc
DESTDIR = ./
VER_MAJ = 1
VER_MIN = 0

####### Files

HEADERS =	
SOURCES =	mocgen.cpp \
		../tools/qbuffer.cpp \
		../tools/qcollection.cpp \
		../tools/qdatetime.cpp \
		../tools/qdatastream.cpp \
		../tools/qgarray.cpp \
		../tools/qgdict.cpp \
		../tools/qglist.cpp \
		../tools/qglobal.cpp \
		../tools/qgvector.cpp \
		../tools/qiodevice.cpp \
		../tools/qstring.cpp
OBJECTS =	mocgen.o \
		qbuffer.o \
		qcollection.o \
		qdatetime.o \
		qdatastream.o \
		qgarray.o \
		qgdict.o \
		qglist.o \
		qglobal.o \
		qgvector.o \
		qiodevice.o \
		qstring.o
SRCMOC	=	
OBJMOC	=	

####### Implicit rules

.SUFFIXES: .cpp .cxx .cc .C .c

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

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

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

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

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

####### Build rules

all: $(DESTDIR)$(TARGET)

$(DESTDIR)$(TARGET): $(OBJECTS) $(OBJMOC) 
	$(SYSCONF_LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)

moc: $(SRCMOC)

tmake:
	tmake moc.pro

clean:
	-rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC)
	-rm -f *~ core

####### Compile

mocgen.o: mocgen.cpp \
		lex.yy.c
	$(CC) -c $(CFLAGS) -o mocgen.o mocgen.cpp

qbuffer.o: ../tools/qbuffer.cpp \
		../tools/qbuffer.h \
		../tools/qiodevice.h \
		../tools/qglobal.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qgeneric.h
	$(CC) -c $(CFLAGS) -o qbuffer.o ../tools/qbuffer.cpp

qcollection.o: ../tools/qcollection.cpp \
		../tools/qcollection.h \
		../tools/qglobal.h
	$(CC) -c $(CFLAGS) -o qcollection.o ../tools/qcollection.cpp

qdatetime.o: ../tools/qdatetime.cpp \
		../tools/qdatetime.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qglobal.h \
		../tools/qgeneric.h \
		../tools/qdatastream.h \
		../tools/qiodevice.h
	$(CC) -c $(CFLAGS) -o qdatetime.o ../tools/qdatetime.cpp

qdatastream.o: ../tools/qdatastream.cpp \
		../tools/qdatastream.h \
		../tools/qiodevice.h \
		../tools/qglobal.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qgeneric.h \
		../tools/qbuffer.h
	$(CC) -c $(CFLAGS) -o qdatastream.o ../tools/qdatastream.cpp

qgarray.o: ../tools/qgarray.cpp \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qglobal.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgeneric.h
	$(CC) -c $(CFLAGS) -o qgarray.o ../tools/qgarray.cpp

qgdict.o: ../tools/qgdict.cpp \
		../tools/qgdict.h \
		../tools/qcollection.h \
		../tools/qglobal.h \
		../tools/qlist.h \
		../tools/qglist.h \
		../tools/qgeneric.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qdatastream.h \
		../tools/qiodevice.h
	$(CC) -c $(CFLAGS) -o qgdict.o ../tools/qgdict.cpp

qglist.o: ../tools/qglist.cpp \
		../tools/qglist.h \
		../tools/qcollection.h \
		../tools/qglobal.h \
		../tools/qgvector.h \
		../tools/qdatastream.h \
		../tools/qiodevice.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qgeneric.h
	$(CC) -c $(CFLAGS) -o qglist.o ../tools/qglist.cpp

qglobal.o: ../tools/qglobal.cpp \
		../tools/qglobal.h \
		../tools/qdict.h \
		../tools/qgdict.h \
		../tools/qcollection.h \
		../tools/qgeneric.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h
	$(CC) -c $(CFLAGS) -o qglobal.o ../tools/qglobal.cpp

qgvector.o: ../tools/qgvector.cpp \
		../tools/qgvector.h \
		../tools/qcollection.h \
		../tools/qglobal.h \
		../tools/qglist.h \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qgeneric.h \
		../tools/qdatastream.h \
		../tools/qiodevice.h
	$(CC) -c $(CFLAGS) -o qgvector.o ../tools/qgvector.cpp

qiodevice.o: ../tools/qiodevice.cpp \
		../tools/qiodevice.h \
		../tools/qglobal.h
	$(CC) -c $(CFLAGS) -o qiodevice.o ../tools/qiodevice.cpp

qstring.o: ../tools/qstring.cpp \
		../tools/qstring.h \
		../tools/qarray.h \
		../tools/qgarray.h \
		../tools/qshared.h \
		../tools/qglobal.h \
		../tools/qgeneric.h \
		../tools/qdatastream.h \
		../tools/qiodevice.h
	$(CC) -c $(CFLAGS) -o qstring.o ../tools/qstring.cpp


####### Lex/yacc programs and options

LEX	=	flex
YACC	=	yacc -d

####### Lex/yacc files

LEXIN	=	moc.l
LEXOUT  =	lex.yy.c
YACCIN	=	moc.y
YACCOUT =	y.tab.c
YACCHDR =	y.tab.h
MOCGEN  =	mocgen.cpp

####### Process lex/yacc files

$(LEXOUT): $(LEXIN)
	$(LEX) $(LEXIN)

$(MOCGEN): $(YACCIN) $(LEXOUT)
	$(YACC) $(YACCIN)
	-rm -f $(MOCGEN)
	-mv $(YACCOUT) $(MOCGEN)
