summaryrefslogtreecommitdiff
path: root/science/qcl/files/patch-aa
blob: 9b3bc17cd88339962ee469266eac027c35886735 (plain) (blame)
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
--- Makefile.orig	Wed Jan 17 13:17:06 2001
+++ Makefile	Thu May 24 15:51:01 2001
@@ -14,29 +14,25 @@
 
 # Directory for Standard .qcl files
 
-QCLDIR = /usr/local/lib/qcl
+QCLDIR = ${PREFIX}/share/qcl
 
 # Path for qcl binaries
 
-QCLBIN = /usr/local/bin
+QCLBIN = ${PREFIX}/bin
 
 # Debugging options
 
-DEBUG = -g -DQCL_DEBUG -DQC_DEBUG
-#DEBUG = -O2
+DEBUG = 
 
 # Comment out if you don't have GNU readline on your system
 # explicit linking against libtermcap or libncurses may be required
 
 RLOPT = -DQCL_USE_READLINE
-#RLLIB = -lreadline
-RLLIB = -lreadline -lncurses
+RLLIB = -lreadline
 
 # Replace with lex and yacc on non-GNU systems (untested)
 
-LEX = flex
-YACC = bison
-INSTALL = install
+INSTALL = install -c
 
 ##### You shouldn't have to edit the stuff below #####
 
@@ -44,13 +40,15 @@
 QCLIB = $(QCDIR)/libqc.a
 QCLINC = lib
 
-CC = g++
-CPP = $(CC) -E
-CFLAGS = -c -Wall $(DEBUG) $(RLOPT) -I$(QCDIR) -DDEF_INCLUDE_PATH="\"$(QCLDIR)\""
-LFLAGS = -L$(QCDIR) $(DEBUG) -lm -lfl -lqc $(RLLIB) 
+CXXFLAGS += -Wall $(DEBUG) $(RLOPT) -I$(QCDIR) -I${PREFIX}/include -DDEF_INCLUDE_PATH="\"$(QCLDIR)\""
+LDFLAGS += -L$(QCDIR) $(DEBUG) -L${PREFIX}/lib -lgnugetopt -lm -lfl -lqc $(RLLIB) 
+
+FILESCC = debug.cc error.cc eval.cc exec.cc extern.cc lex.cc \
+	options.cc parse.cc print.cc qcl.cc quheap.cc symbols.cc \
+	syntax.cc typcheck.cc types.cc yacc.cc
+FILESH = debug.h error.h extern.h options.h parse.h quheap.h \
+	symbols.h syntax.h types.h yacc.h
 
-FILESCC = $(wildcard *.cc)
-FILESH = $(wildcard *.h)
 
 SOURCE = $(FILESCC) $(FILESH) qcl.lex qcl.y Makefile
 
@@ -58,23 +56,11 @@
           lex.o yacc.o print.o quheap.o extern.o eval.o exec.o \
           parse.o options.o debug.o
 
-all: do-it-all
+all: build
+
 
-ifeq (.depend,$(wildcard .depend))
-include .depend
-do-it-all: build
-else
-do-it-all: dep
-	make
-endif
-
-#### Rules for depend
-
-dep: lex.cc yacc.cc yacc.h $(QCLIB)
-	for i in *.cc; do \
-	  $(CPP) -I$(QCDIR) -MM $$i; \
-	  echo -e '\t$(CC) $(CFLAGS)' $$i '\n'; \
-	done > .depend
+dep: $(FILESCC) $(FILESH)
+	$(CXX) -M $(CXXFLAGS) $(FILESCC) >.depend
 
 lex.cc: qcl.lex
 	$(LEX) -olex.cc qcl.lex
@@ -86,24 +72,24 @@
 	mv yacc.cc.h yacc.h
 
 $(QCLIB):
-	cd $(QCDIR) && make libqc.a
+	cd $(QCDIR) && $(MAKE) $(MAKEFLAGS) libqc.a
 
 #### Rules for build
 
 build: qcl $(QCLINC)/default.qcl
 
 qcl: $(OBJECTS) qcl.o $(QCLIB)
-	$(CC) $(OBJECTS) qcl.o $(LFLAGS) -o qcl
+	$(CXX) $(OBJECTS) qcl.o $(LDFLAGS) -o qcl
 
 qcl-static: $(OBJECTS) qcl.o $(QCLIB)
-	$(CC) -static $(OBJECTS) qcl.o $(LFLAGS) -o qcl-static
+	$(CXX) -static $(OBJECTS) qcl.o $(LDFLAGS) -o qcl-static
 	strip qcl-static
 
 $(QCLINC)/default.qcl: extern.cc
 	grep "^//!" extern.cc | cut -c5- > $(QCLINC)/default.qcl
 
 install: build
-	$(INSTALL) -m 0755 -d $(QCLBIN) $(QCLDIR)
+	umask 022; mkdir -p $(QCLDIR); chmod 0755 $(QCLDIR)
 	$(INSTALL) -m 0755 ./qcl $(QCLBIN)
 	$(INSTALL) -m 0644 ./lib/default.qcl $(QCLDIR)
 	$(INSTALL) -m 0644 ./lib/dft.qcl $(QCLDIR)
@@ -115,6 +101,7 @@
 	$(INSTALL) -m 0644 ./lib/roulette.qcl $(QCLDIR)
 	$(INSTALL) -m 0644 ./lib/shor.qcl $(QCLDIR)
 	$(INSTALL) -m 0644 ./lib/swap.qcl $(QCLDIR)
+	$(INSTALL) -m 0644 ./lib/grover.qcl $(QCLDIR)
 
 #### Other Functions