# Makefile for qc-0.3
#
# This file is part of the Quantum Computation Library (QCLIB).
# 
# (c) Copyright by Bernhard Oemer <oemer@tph.tuwien.ac.at>, 1998
# 
# This program comes without any warranty; without even the implied 
# warranty of merchantability or fitness for any particular purpose.
# 
#      This program is free software under the terms of the 
#      GNU General Public Licence (GPL) version 2 or higher

CC = g++
#CCOPT = -c -O2 -pedantic
CCOPT = -c -g -pedantic -DQC_DEBUG
LNKOPT = -L. -lm -lqc

FILESCC = bitvec.cc terms.cc qustates.cc operator.cc
FILESH = bitvec.h terms.h qustates.h operator.h qc.h
SOURCE = $(FILESCC) $(FILESH) shor.cc Makefile

all: libqc.a

libqc.a: bitvec.o terms.o qustates.o operator.o
	ar rc libqc.a bitvec.o terms.o qustates.o operator.o
	ranlib libqc.a

bitvec.o: bitvec.cc bitvec.h
	$(CC) bitvec.cc -o bitvec.o $(CCOPT)

terms.o: terms.cc terms.h bitvec.h
	$(CC) terms.cc -o terms.o $(CCOPT)

qustates.o: qustates.cc qustates.h terms.h bitvec.h
	$(CC) qustates.cc -o qustates.o $(CCOPT)

operator.o: operator.cc operator.h qustates.h terms.h bitvec.h
	$(CC) operator.cc -o operator.o $(CCOPT)

shor.o: shor.cc qustates.h terms.h bitvec.h 
	$(CC) shor.cc -o shor.o $(CCOPT)

shor: shor.o libqc.a 
	$(CC)  shor.o -o shor $(LNKOPT)

# Other Functions

SOURCEFILES = `ls $(SOURCE)`

edit:
	nedit -iconic $(SOURCEFILES) &

clean:
	rm -f *.o 

clear: clean
	rm -f libqc.a shor
