1# Makefile for libqc
2#
3# This file is part of the Quantum Computation Library (QCLIB).
4#
5# (c) Copyright by Bernhard Oemer <oemer@tph.tuwien.ac.at>, 1998-2014
6#
7# This program comes without any warranty; without even the implied
8# warranty of merchantability or fitness for any particular purpose.
9#
10#      This program is free software under the terms of the
11#      GNU General Public Licence (GPL) version 2 or higher
12
13# Comment out if you want to compile for a different target architecture
14
15#ARCHOPT = -m32 -march=i686
16
17# Debugging options
18
19DEBUG =  -DQC_DEBUG
20#DEBUG = -g -pg -DQC_DEBUG
21#DEBUG = -O2
22
23# Comment out if you if you want to use SysV Xrand48() linear congruential
24# PRG instead of the default random() non-linear additive  feedback PRG.
25
26#PRGOPT = -DQC_USE_RAND48
27
28CXXFLAGS += $(ARCHOPT) -c -pedantic -Wall $(DEBUG) $(PRGOPT)
29
30LDFLAGS += $(ARCHOPT) -L. -lm -lqc
31
32FILESCC = bitvec.cc terms.cc qustates.cc operator.cc
33FILESH = bitvec.h terms.h qustates.h operator.h qc.h
34SOURCE = $(FILESCC) $(FILESH) shor.cc Makefile
35
36all: libqc.a
37
38libqc.a: bitvec.o terms.o qustates.o operator.o
39	ar rc libqc.a bitvec.o terms.o qustates.o operator.o && ranlib libqc.a
40
41bitvec.o: bitvec.cc bitvec.h
42	$(CXX) bitvec.cc -o bitvec.o $(CXXFLAGS)
43
44terms.o: terms.cc terms.h bitvec.h
45	$(CXX) terms.cc -o terms.o $(CXXFLAGS)
46
47qustates.o: qustates.cc qustates.h terms.h bitvec.h
48	$(CXX) qustates.cc -o qustates.o $(CXXFLAGS)
49
50operator.o: operator.cc operator.h qustates.h terms.h bitvec.h
51	$(CXX) operator.cc -o operator.o $(CXXFLAGS)
52
53shor.o: shor.cc qustates.h terms.h bitvec.h
54	$(CXX) shor.cc -o shor.o $(CXXFLAGS)
55
56shor: shor.o libqc.a
57	$(CXX)  shor.o -o shor $(LNKOPT)
58
59# Other Functions
60
61edit:
62	nedit $(SOURCE) &
63
64clean:
65	rm -f *.o
66
67clear: clean
68	rm -f libqc.a shor
69