Makefile 8.2 KB
Newer Older
bbr's avatar
bbr committed
1
2
3
4
5
#######################################################
## edit the next two lines or set the according paths
#######################################################

GHCBIN = $(shell which ghc)
bbr's avatar
mini    
bbr committed
6
CYMAKEBIN = $(shell which cymake)
bbr's avatar
bbr committed
7
8
9
10
11

########################################################
## paths within the kics folder
########################################################

bbr's avatar
bbr committed
12
BIN = bin/
Bernd Brassel's avatar
Bernd Brassel committed
13
14
SRC_DIR = src
SRC = $(SRC_DIR)/
bbr's avatar
bbr committed
15
DOC = doc/
bbr's avatar
bbr committed
16
LIB = $(SRC)lib/
Bernd Brassel's avatar
Bernd Brassel committed
17
18
TOOLS_DIR = $(SRC)tools
TOOLS = $(TOOLS_DIR)/
bbr's avatar
bbr committed
19
20
DIST = dist/
THIS = ../kics/
bbr's avatar
bbr committed
21
22
23
ORACLE = $(SRC)oracle/
CPNS = cpns/
WWW = www/
Bernd Brassel's avatar
Bernd Brassel committed
24
CURRYSUB = .curry/
Bernd Brassel's avatar
Bernd Brassel committed
25
KICSSUB = $(CURRYSUB)kics/
bbr's avatar
bbr committed
26
27
28
29
30

########################################################
## calls to compilers 
########################################################

Bernd Brassel's avatar
Bernd Brassel committed
31
32
HC_OPTS = -i$(SRC_DIR) -i$(TOOLS_DIR)

bbr's avatar
bbr committed
33
GHCCALL = $(GHCBIN) --make -fglasgow-exts -H500m
bbr's avatar
bbr committed
34
35
KGHC = $(GHCCALL) -i$(LIBS) 
GHC  = $(GHCCALL) -i$(SRC) 
Bernd Brassel's avatar
Bernd Brassel committed
36
CY   = $(CYMAKEBIN) -e 
bbr's avatar
bbr committed
37
LIBS = $(shell $(BIN)kicslib)
Bernd Brassel's avatar
Bernd Brassel committed
38
KICS = $(BIN)kics -nouserlibpath -v 6 -make
bbr's avatar
bbr committed
39

40
SRCS = $(SRC)kics.hs $(SRC)kicsi.hs $(SRC)kicslib.hs 
Bernd Brassel's avatar
Bernd Brassel committed
41

bbr's avatar
bbr committed
42
43
44
########################################################
## the make destinations
########################################################
bbr's avatar
bbr committed
45

46
all: $(SRC)InstallDir.hs $(BIN)kicslib $(BIN)kics \
Bernd Brassel's avatar
Bernd Brassel committed
47
     $(BIN)kicsi libs cpns www tools
bbr's avatar
bbr committed
48
49

.PHONY: tools
50
tools:  $(SRC)InstallDir.hs $(BIN)prettyflat\
bbr's avatar
bbr committed
51
	$(BIN)currytest $(BIN)prettyacy
bbr's avatar
bbr committed
52

bbr's avatar
bbr committed
53
$(SRC)InstallDir.hs: prerequisites
54
55
56
57
58
	@echo "module InstallDir where"  >  $(SRC)InstallDir.hs.tmp
	@echo "installDir = \""`pwd`"\"" >> $(SRC)InstallDir.hs.tmp
	@echo "ghc_call= \""$(GHCBIN)"\"" >> $(SRC)InstallDir.hs.tmp
	@if cmp -s $(SRC)InstallDir.hs.tmp $(SRC)InstallDir.hs; then \
	  echo "InstallDir.hs up to date"; rm $(SRC)InstallDir.hs.tmp; \
bbr's avatar
bbr committed
59
	else \
60
	  echo "replacing InstallDir.hs"; mv $(SRC)InstallDir.hs.tmp $(SRC)InstallDir.hs; \
bbr's avatar
bbr committed
61
	fi
Bernd Brassel's avatar
Bernd Brassel committed
62
63
64
65
	@echo "#!/bin/sh" > $(BIN)parsecurry
	@echo $(CYMAKEBIN) $$\@ >> $(BIN)parsecurry
	@chmod +x $(BIN)parsecurry

bbr's avatar
bbr committed
66
67
68
69
70
71
72
73
74
75
76

prerequisites:
ifeq (,$(findstring ghc,$(GHCBIN)))
	@echo "please set a path to a valid ghc binary"
	exit 1
endif
ifeq (,$(findstring cymake,$(CYMAKEBIN)))
	@echo "please set a path to a valid curry frontend (a cymake binary)"
	exit 1
endif

bbr's avatar
bbr committed
77

Bernd Brassel's avatar
Bernd Brassel committed
78
$(BIN)kicslib: $(SRC)kicslib.hi
bbr's avatar
bbr committed
79
	mkdir -p bin 
bbr's avatar
bbr committed
80
	$(GHC) $(SRC)kicslib -o $(BIN)kicslib
bbr's avatar
bbr committed
81
82
83
84

$(BIN)makeExternalInterface: $(SRC)InstallDir.hs $(BIN)kicslib
	$(KGHC) $(SRC)MakeExternalInterface -o $(BIN)makeExternalInterface

Bernd Brassel's avatar
Bernd Brassel committed
85
$(SRC)MyReadline.hs:
Bernd Brassel's avatar
Bernd Brassel committed
86
87
ifeq (,$(filter readline% editline%,$(shell  $(GHCBIN)-pkg list readline)))
	@echo neither readline nor editline package found
Bernd Brassel's avatar
Bernd Brassel committed
88
	cp $(SRC)NoReadline.make $(SRC)MyReadline.hs 
bbr's avatar
bbr committed
89
else
Bernd Brassel's avatar
Bernd Brassel committed
90
	@echo readline or editline package found
bbr's avatar
bbr committed
91
92
	cp $(SRC)WithReadline.make $(SRC)MyReadline.hs
endif
Bernd Brassel's avatar
Bernd Brassel committed
93
94
95


$(BIN)kicsi: $(BIN)kicslib $(SRC)kicsi.o $(SRC)MyReadline.hs
bbr's avatar
bbr committed
96
97
	$(KGHC) $(SRC)kicsi -o $(BIN)kicsi

Bernd Brassel's avatar
Bernd Brassel committed
98
$(BIN)kics:  $(BIN)kicslib $(SRC)kics.hi
bbr's avatar
bbr committed
99
100
101
102
	$(KGHC) $(SRC)kics -o $(BIN)kics

.PHONY: runtime
runtime: $(SRC)InstallDir.hs  
103
	$(GHC) -fno-cse Curry.RunTimeSystem
bbr's avatar
bbr committed
104
105

.PHONY: libs 
106
libs: $(BIN)kics runtime $(BIN)makeacy
Bernd Brassel's avatar
Bernd Brassel committed
107

bbr's avatar
bbr committed
108
	$(KICS) $(LIB)All_Libraries
Bernd Brassel's avatar
Bernd Brassel committed
109
	cd $(LIB); ../../bin/makeacy All_Libraries
bbr's avatar
bbr committed
110

Bernd Brassel's avatar
Bernd Brassel committed
111
.PHONY: 
bbr's avatar
bbr committed
112
clean:
Bernd Brassel's avatar
Bernd Brassel committed
113
	git clean -dfX
bbr's avatar
bbr committed
114
115


bbr's avatar
bbr committed
116
.PHONY: dist 
Bernd Brassel's avatar
Bernd Brassel committed
117
dist: $(DOC)UserManual.pdf $(DOC)UserManual.html
bbr's avatar
bbr committed
118
	mkdir -p dist
bbr's avatar
bbr committed
119
120
	git archive -v --prefix=kics/ master > $(THIS)$(DIST)kics_src.tar
	tar fr $(THIS)$(DIST)kics_src.tar  $(THIS)$(DOC)/UserManual.pdf 
Bernd Brassel's avatar
Bernd Brassel committed
121
	tar fr $(THIS)$(DIST)kics_src.tar  $(THIS)$(DOC)/UserManual.html 
bbr's avatar
bbr committed
122
123
	gzip -9 -f $(THIS)$(DIST)kics_src.tar 
	mv $(THIS)$(DIST)kics_src.tar.gz ~/public_html/download/kics_src.tgz
bbr's avatar
bbr committed
124
	mv $(DOC)UserManual.pdf ~/public_html/download/
Bernd Brassel's avatar
Bernd Brassel committed
125
	mv $(DOC)UserManual.html ~/public_html/kics/
bbr's avatar
bbr committed
126
	chmod a+r ~/public_html/download/kics_src.tgz
bbr's avatar
bbr committed
127
	chmod a+r ~/public_html/download/UserManual.pdf
128
	git push "at public"
bbr's avatar
bbr committed
129

130
131
132
133
134
135
.PHONY: oracle
oracle: OracleLib $(BIN)prophecy
	$(BIN)prophecy -m All_Libraries
	$(KICS) --debug All_Libraries

bio: oracle $(BIN)stricths $(BIN)biotope  biostdlibraries
bbr's avatar
bbr committed
136
137

OracleLib: $(LIB)Oracle.curry $(LIB)coracle.c $(LIB)coracle.h\
bbr's avatar
bbr committed
138
           $(LIB)ExternalFunctionsCEventOracle.hs
139
	$(KICS) $(LIB)Oracle
bbr's avatar
bbr committed
140
141
	cd $(LIB);cc -fPIC -c coracle.c;\
          ar rc libcoracle.a coracle.o;\
bbr's avatar
bbr committed
142
143
144
145
146
	  if cc -shared -o libdyncoracle.so coracle.o; then \
	    echo "shared library compiled"; \
	  else \
	    cc -dynamiclib -single_module -o libdyncoracle.dylib coracle.o; \
	  fi
bbr's avatar
bbr committed
147
	$(KGHC) -i.. -L. -lcoracle $(LIB)ExternalFunctionsCEventOracle.hs
bbr's avatar
bbr committed
148
	$(KICS) $(LIB)Oracle
bbr's avatar
bbr committed
149

bbr's avatar
bbr committed
150
$(BIN)stricths: $(ORACLE)stricths.curry $(ORACLE)PrettyStrict.curry
bbr's avatar
bbr committed
151
152
	$(KICS) -executable -o $(BIN)stricths -userlibpath $(ORACLE) stricths.curry 

bbr's avatar
bbr committed
153
$(BIN)prophecy: $(ORACLE)Transform.curry $(ORACLE)Wrapper.curry
bbr's avatar
bbr committed
154
	$(KICS) -executable -o $(BIN)prophecy -userlibpath $(ORACLE) Transform.curry 
bbr's avatar
bbr committed
155

bbr's avatar
bbr committed
156
157
158
$(BIN)biotope: $(ORACLE)Biotope.curry
	$(KICS) -executable -o $(BIN)biotope -userlibpath $(ORACLE) Biotope.curry 

159
160
161
bioprelude:
	cd $(LIB);stricths Prelude;prophecy Prelude;cd ../..

bbr's avatar
bbr committed
162
biostdlibraries: 
163
	$(BIN)stricths -m All_Libraries
Bernd Brassel's avatar
Bernd Brassel committed
164
	$(KGHC) -O2 $(LIB)$(CURRYSUB)StrictAll_Libraries.hs
bbr's avatar
bbr committed
165
	$(KICS) --debug All_Libraries
bbr's avatar
bbr committed
166

bbr's avatar
bbr committed
167
$(BIN)prettyflat: $(LIB)PrettyFlat.curry 
bbr's avatar
bbr committed
168
	$(KICS) -executable -o $(BIN)prettyflat -main mainPrint PrettyFlat.curry 
bbr's avatar
bbr committed
169

bbr's avatar
bbr committed
170
$(BIN)prettyacy: $(TOOLS)prettyacy.hs $(TOOLS)AbstractCurry.hs
bbr's avatar
bbr committed
171
172
	$(GHC) -i$(TOOLS) -o $(BIN)prettyacy $(TOOLS)prettyacy.hs

Bernd Brassel's avatar
Bernd Brassel committed
173
$(BIN)currytest: $(TOOLS)currytest.curry
bbr's avatar
bbr committed
174
175
	$(KICS) -userlibpath $(TOOLS) -executable -o $(BIN)currytest -main main currytest.curry 

bbr's avatar
bbr committed
176
177
178
cpns: $(CPNS)CPNS.state

$(CPNS)CPNS.state: $(LIB)CPNS.curry
bbr's avatar
bbr committed
179
180
	$(KICS) -executable -o $(CPNS)CPNS.state $(LIB)CPNS.curry

Bernd Brassel's avatar
Bernd Brassel committed
181
www: $(WWW)submitform
bbr's avatar
bbr committed
182

Bernd Brassel's avatar
Bernd Brassel committed
183
$(WWW)submitform: $(LIB)HtmlCgi.curry
bbr's avatar
bbr committed
184
185
	make -C $(WWW)

Bernd Brassel's avatar
Bernd Brassel committed
186
187
188
189
190
191
192
193
$(DOC)UserManual.pdf: $(DOC)UserManual.text 
	cd $(DOC); \
	 pandoc -s --toc UserManual.text -o UserManual.tex; \
	 pdflatex UserManual; pdflatex UserManual

$(DOC)UserManual.html: $(DOC)UserManual.text 
	cd $(DOC); \
	 pandoc -s --toc UserManual.text -o UserManual.html
Bernd Brassel's avatar
Bernd Brassel committed
194
195


Bernd Brassel's avatar
Bernd Brassel committed
196
$(BIN)makeacy: $(TOOLS)MakeAcy.curry $(BIN)kics
Bernd Brassel's avatar
Bernd Brassel committed
197
	$(KICS) -executable -o $(BIN)makeacy -userlibpath $(ORACLE):$(TOOLS) MakeAcy
Bernd Brassel's avatar
Bernd Brassel committed
198
199
200
201
202


.PHONY: 
test: $(BIN)currytest
	cd examples;./doTest
Bernd Brassel's avatar
Bernd Brassel committed
203
204

depend : $(SRC)MyReadline.hs
Bernd Brassel's avatar
Bernd Brassel committed
205
	$(GHC) -M $(HC_OPTS) $(SRCS)
Bernd Brassel's avatar
Bernd Brassel committed
206
207

%.hi: %.o %.hs
Bernd Brassel's avatar
Bernd Brassel committed
208
	$(GHC) --make  $(HC_OPTS) $*.hs
Bernd Brassel's avatar
Bernd Brassel committed
209

210

Bernd Brassel's avatar
Bernd Brassel committed
211
212
# DO NOT DELETE: Beginning of Haskell dependencies
src/InstallDir.o : src/InstallDir.hs
213
src/SafeCalls.o : src/SafeCalls.hs
Bernd Brassel's avatar
Bernd Brassel committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
src/KicsSubdir.o : src/KicsSubdir.hs
src/MetaProgramming/FlatCurry.o : src/MetaProgramming/FlatCurry.hs
src/MetaProgramming/FlatCurry.o : src/KicsSubdir.hi
src/MetaProgramming/FlatCurryGoodies.o : src/MetaProgramming/FlatCurryGoodies.hs
src/MetaProgramming/FlatCurryGoodies.o : src/MetaProgramming/FlatCurry.hi
src/Simplification.o : src/Simplification.hs
src/Simplification.o : src/MetaProgramming/FlatCurryGoodies.hi
src/Simplification.o : src/MetaProgramming/FlatCurryGoodies.hi
src/Simplification.o : src/MetaProgramming/FlatCurry.hi
src/PreTrans.o : src/PreTrans.hs
src/PreTrans.o : src/MetaProgramming/FlatCurryGoodies.hi
src/PreTrans.o : src/MetaProgramming/FlatCurry.hi
src/FunctionalProg.o : src/FunctionalProg.hs
src/Brace.o : src/Brace.hs
src/ShowFlatCurry.o : src/ShowFlatCurry.hs
src/ShowFlatCurry.o : src/Brace.hi
src/ShowFlatCurry.o : src/MetaProgramming/FlatCurry.hi
src/ShowFunctionalProg.o : src/ShowFunctionalProg.hs
src/ShowFunctionalProg.o : src/Brace.hi
src/ShowFunctionalProg.o : src/FunctionalProg.hi
src/Names.o : src/Names.hs
src/Names.o : src/ShowFunctionalProg.hi
src/Config.o : src/Config.hs
src/Config.o : src/KicsSubdir.hi
src/Config.o : src/Names.hi
src/Config.o : src/MetaProgramming/FlatCurry.hi
src/Config.o : src/SafeCalls.hi
src/Config.o : src/InstallDir.hi
src/CurryToHaskell.o : src/CurryToHaskell.hs
src/CurryToHaskell.o : src/Names.hi
src/CurryToHaskell.o : src/Names.hi
src/CurryToHaskell.o : src/Config.hi
src/CurryToHaskell.o : src/Brace.hi
src/CurryToHaskell.o : src/SafeCalls.hi
src/CurryToHaskell.o : src/Simplification.hi
src/CurryToHaskell.o : src/PreTrans.hi
src/CurryToHaskell.o : src/ShowFunctionalProg.hi
src/CurryToHaskell.o : src/FunctionalProg.hi
src/CurryToHaskell.o : src/MetaProgramming/FlatCurryGoodies.hi
src/CurryToHaskell.o : src/MetaProgramming/FlatCurry.hi
src/kicsi.o : src/kicsi.hs
src/kicsi.o : src/Names.hi
src/kicsi.o : src/Config.hi
src/kicsi.o : src/ShowFlatCurry.hi
src/kicsi.o : src/MetaProgramming/FlatCurryGoodies.hi
src/kicsi.o : src/MetaProgramming/FlatCurry.hi
src/kicsi.o : src/SafeCalls.hi
src/kicsi.o : src/CurryToHaskell.hi
# DO NOT DELETE: End of Haskell dependencies