1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
# Makefile: Build libquantum
#
# Copyright 2003-2008 Bjoern Butscher, Hendrik Weimer
#
# This file is part of libquantum
#
# libquantum is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# libquantum is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with libquantum; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA
# Every Makefile should contain this line
SHELL=/bin/sh
# Target directory prefix
PREFIX=$(DESTDIR)@prefix@
EPREFIX=$(PREFIX)
# Other directories
LIBDIR=$(EPREFIX)/lib
INCLUDEDIR=$(PREFIX)/include
BINDIR=$(PREFIX)/bin
top_builddir=.
ALLDIRS=$(LIBDIR) $(INCLUDEDIR) $(BINDIR)
# Version information
VERSION=@PACKAGE_VERSION@
# Tools needed to build libquantum
CC=@CC@
INSTALL=@INSTALL@
LIBTOOL=@LIBTOOL@
# Flags passed to C compiler
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@ -rpath $(LIBDIR) -version-info 7:0:0
# Dependencies
all: libquantum.la
libquantum.la: complex.lo measure.lo matrix.lo gates.lo qft.lo classic.lo \
qureg.lo decoherence.lo oaddn.lo omuln.lo expn.lo qec.lo version.lo \
objcode.lo density.lo error.lo qtime.lo lapack.lo Makefile
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o libquantum.la complex.lo \
measure.lo matrix.lo gates.lo oaddn.lo omuln.lo expn.lo qft.lo \
classic.lo qureg.lo decoherence.lo qec.lo version.lo objcode.lo \
density.lo error.lo qtime.lo lapack.lo @LIBS@
complex.lo: complex.c complex.h config.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c complex.c
measure.lo: measure.c measure.h matrix.h qureg.h complex.h config.h error.h \
Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c measure.c
matrix.lo: matrix.c matrix.h complex.h error.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c matrix.c
gates.lo: gates.c gates.h matrix.h defs.h qureg.h error.h decoherence.h \
objcode.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c gates.c
oaddn.lo: oaddn.c matrix.h defs.h gates.h qureg.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c oaddn.c
omuln.lo: omuln.c matrix.h gates.h oaddn.h defs.h qureg.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c omuln.c
expn.lo: expn.c expn.h matrix.h gates.h oaddn.h omuln.h qureg.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c expn.c
qft.lo: qft.c qft.h matrix.h gates.h qureg.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c qft.c
classic.lo: classic.c classic.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c classic.c
qureg.lo: qureg.c qureg.h matrix.h config.h complex.h error.h objcode.h \
Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c qureg.c
decoherence.lo: decoherence.c decoherence.h measure.h gates.h qureg.h \
complex.h config.h error.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c decoherence.c
qec.lo: qec.c qec.h gates.h qureg.h decoherence.h measure.h config.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c qec.c
version.lo: version.c version.h config.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c version.c
objcode.lo: objcode.c objcode.h matrix.h gates.h qureg.h measure.h config.h \
error.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c objcode.c
density.lo: density.c density.h matrix.h qureg.h complex.h config.h error.h \
Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c density.c
error.lo: error.c error.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c error.c
qtime.lo: qtime.c qtime.h qureg.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c qtime.c
lapack.lo: lapack.c lapack.h matrix.h qureg.h config.h error.h Makefile
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c lapack.c
# Autoconf stuff
Makefile: config.status Makefile.in aclocal.m4 config.h.in types.h.in \
quantum.h.in
./config.status
config.h: config.h.in
./config.status
configure: configure.in
autoconf
config.status: configure
./config.status --recheck
# Build demos of Shor's and Grover's algorithms
demos: shor grover
shor: libquantum.la shor.c Makefile
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o shor shor.c -I./ -lquantum \
-static -lm
grover: libquantum.la grover.c Makefile
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o grover grover.c -I./ \
-lquantum -static -lm
# Quantum object code tools
quobtools: quobprint quobdump
quobprint: libquantum.la quobprint.c objcode.h Makefile
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o quobprint quobprint.c \
-lquantum
quobdump: libquantum.la quobdump.c objcode.h Makefile
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o quobdump quobdump.c -lquantum
# Bring this savage back home
install: libquantum.la
$(INSTALL) -d $(ALLDIRS)
$(LIBTOOL) --mode=install $(INSTALL) -m 0644 libquantum.la $(LIBDIR)
$(INSTALL) -m 0644 quantum.h $(INCLUDEDIR)
quobtools_install: quobtools
$(LIBTOOL) --mode=install $(INSTALL) -m 0755 quobprint $(BINDIR)
$(LIBTOOL) --mode=install $(INSTALL) -m 0755 quobdump $(BINDIR)
# Make everything neat and tidy
clean:
-rm -rf .libs
-rm shor grover quobprint quobdump libquantum.la *.lo *.o
distclean: clean
-rm config.h quantum.h types.h config.status config.log
# Build the source tarball
dist:
-rm quantum.h config.h types.h
mkdir libquantum-$(VERSION)
cp *.c *.h *.in configure COPYING install-sh ltmain.sh config.sub \
config.guess aclocal.m4 README INSTALL CHANGES libquantum-$(VERSION)
tar czf libquantum-$(VERSION).tar.gz libquantum-$(VERSION)/
rm -rf libquantum-$(VERSION)
|