1#
2# default base directory for YAP installation
3# (EROOT for architecture-dependent files)
4#
5prefix = @prefix@
6exec_prefix = @exec_prefix@
7ROOTDIR = $(prefix)
8EROOTDIR = @exec_prefix@
9#
10# where the binary should be
11#
12BINDIR = $(EROOTDIR)/bin
13#
14# where YAP should look for binary libraries
15#
16LIBDIR=@libdir@
17YAPLIBDIR=@libdir@/Yap
18#
19# where YAP should look for architecture-independent Prolog libraries
20#
21SHAREDIR=$(ROOTDIR)/share
22#
23# where the includes should be stored
24#
25INCLUDEDIR=$(ROOTDIR)/include/Yap
26#
27# where to store info files
28#
29INFODIR=$(SHAREDIR)/info
30#
31# where to store documentation files
32#
33DOCSDIR=$(SHAREDIR)/doc/Yap
34
35#
36# Add this flag to YAP_EXTRAS if you need the extension:
37#	-DRATIONAL_TREES: allow unification and builtins over rational trees
38#       -DCOROUTINING: implement extra control primitives
39#       -DANALYST: low level profiler
40#	-DDEPTH_LIMIT: support depth-limits in Prolog execution
41#	-DLOW_LEVEL_TRACER: low level tracing
42#
43# very experimental stuff, you'll need to contact the developers
44# if you want to use this:
45#       -DENV_COPY: or-parallelism with environment copying, in Muse style.
46#       -DSBA: or-parallelism with sparse binding arrays.
47#       -DACOW: or-parallelism with copy-on-write.
48#       -DTABLING: support for tabling
49#
50#
51# check also optimisation options in INSTALL file.
52#
53YAP_EXTRAS=-DCUT_C=1 @YAP_EXTRAS@
54
55YAPSTARTUP=startup.yss
56
57#
58# Please do not add YAP_EXTRA flags here: if you do check the flags
59# for c_interface.c
60#
61CC=@CC@
62MPI_CC=@MPI_CC@
63CPPFLAGS=@CPPFLAGS@  -I. -I$(srcdir)/H -I$(srcdir)/OPTYap -I$(srcdir)/BEAM -I$(srcdir)/MYDDAS
64EXECUTABLE_CFLAGS= @CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
65CFLAGS=  @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
66C_INTERF_FLAGS= @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS) -I$(srcdir)/include
67C_PARSER_FLAGS= @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
68#
69#
70# You shouldn't need to change what follows.
71#
72ARCH=@ARCH@
73AWK=@AWK@
74CPP=@CPP@
75DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1
76LIBS=@LIBS@
77LDFLAGS=@LDFLAGS@
78LN_S=@LN_S@
79M4=@M4@
80GCC=@GCC@
81INSTALL=@INSTALL@
82INSTALL_DATA=@INSTALL_DATA@
83INSTALL_INFO=@INSTALL_INFO@
84INSTALL_PROGRAM=@INSTALL_PROGRAM@
85M4GENHDRS=$(srcdir)/@M4GENHDRS@
86M4GENABSMI=$(srcdir)/@M4GENABSMI@
87INDENT=@INDENT@
88SHELL=@SHELL@
89RANLIB=@RANLIB@
90AR=@AR@
91srcdir=@srcdir@
92abs_top_builddir=@abs_top_builddir@
93SO=@SO@
94MAKEINFO=makeinfo
95TEXI2DVI=texi2dvi
96TEXI2HTML=texi2html
97TEXI2PDF=texi2pdf -b
98YAPLIB=@YAPLIB@
99SONAMEFLAG=@SONAMEFLAG@
100
101#4.1VPATH=@srcdir@:@srcdir@/OPTYap
102CWD=$(PWD)
103#
104VERSION=6.2.2
105MYDDAS_VERSION=MYDDAS-0.9.1
106#
107
108INTERFACE_HEADERS = \
109	$(srcdir)/include/c_interface.h \
110	$(srcdir)/include/clause_list.h \
111	$(srcdir)/include/dswiatoms.h \
112	$(srcdir)/include/udi.h \
113	$(srcdir)/include/rtree_udi.h \
114	$(srcdir)/include/yap_structs.h \
115	$(srcdir)/include/YapInterface.h \
116	$(srcdir)/include/SWI-Prolog.h \
117	$(srcdir)/include/SWI-Stream.h
118
119HEADERS = \
120	$(srcdir)/H/TermExt.h \
121	$(srcdir)/H/Atoms.h \
122	$(srcdir)/H/Tags_32bits.h \
123	$(srcdir)/H/Tags_32Ops.h \
124	$(srcdir)/H/Tags_32LowTag.h \
125	$(srcdir)/H/Tags_64bits.h \
126	$(srcdir)/H/Tags_24bits.h \
127	$(srcdir)/H/sshift.h \
128	$(srcdir)/H/Yap.h \
129	$(srcdir)/H/Yatom.h \
130	$(srcdir)/H/YapHeap.h \
131	$(srcdir)/H/Regs.h \
132	$(srcdir)/H/Yapproto.h \
133	$(srcdir)/H/absmi.h  \
134	$(srcdir)/H/alloc.h \
135	$(srcdir)/H/amidefs.h \
136	$(srcdir)/H/amiops.h \
137	$(srcdir)/H/arrays.h \
138	$(srcdir)/H/arith2.h \
139	$(srcdir)/H/attvar.h \
140	$(srcdir)/H/clause.h \
141	$(srcdir)/H/compile.h \
142	$(srcdir)/H/corout.h \
143	$(srcdir)/H/dlmalloc.h \
144	$(srcdir)/H/dglobals.h \
145	$(srcdir)/H/dhstruct.h \
146	$(srcdir)/H/eval.h \
147	$(srcdir)/H/heapgc.h   \
148	$(srcdir)/H/hglobals.h \
149	$(srcdir)/H/hstruct.h \
150	$(srcdir)/H/iglobals.h \
151	$(srcdir)/H/ihstruct.h \
152	$(srcdir)/H/index.h \
153	$(srcdir)/H/iopreds.h \
154	$(srcdir)/H/iswiatoms.h \
155	$(srcdir)/H/rclause.h \
156	$(srcdir)/H/rglobals.h \
157	$(srcdir)/H/rheap.h \
158	$(srcdir)/H/rhstruct.h \
159	$(srcdir)/H/threads.h \
160	$(srcdir)/H/tracer.h \
161	$(srcdir)/H/trim_trail.h \
162	$(srcdir)/H/yapio.h \
163	$(srcdir)/BEAM/eam.h $(srcdir)/BEAM/eamamasm.h \
164	$(srcdir)/OPTYap/opt.config.h \
165	$(srcdir)/OPTYap/opt.proto.h $(srcdir)/OPTYap/opt.structs.h \
166	$(srcdir)/OPTYap/opt.macros.h $(srcdir)/OPTYap/or.macros.h \
167	$(srcdir)/OPTYap/or.sbaamiops.h $(srcdir)/OPTYap/or.sbaunify.h \
168	$(srcdir)/OPTYap/tab.structs.h $(srcdir)/OPTYap/locks_x86.h \
169	$(srcdir)/OPTYap/locks_sparc.h $(srcdir)/OPTYap/locks_mips.h \
170	$(srcdir)/OPTYap/locks_mips_funcs.h $(srcdir)/OPTYap/locks_alpha.h \
171	$(srcdir)/OPTYap/locks_alpha_funcs.h \
172	$(srcdir)/OPTYap/locks_pthread.h \
173	$(srcdir)/H/cut_c.h \
174	$(srcdir)/H/iatoms.h $(srcdir)/H/ratoms.h $(srcdir)/H/tatoms.h \
175	$(srcdir)/library/dialect/swi/fli/swi.h \
176	$(srcdir)/MYDDAS/myddas.h $(srcdir)/MYDDAS/myddas_structs.h \
177	$(srcdir)/MYDDAS/myddas_statistics.h \
178	$(srcdir)/MYDDAS/myddas_statistics_structs.h \
179	$(srcdir)/MYDDAS/myddas_wkb.h $(srcdir)/MYDDAS/myddas_wkb2prolog.h
180
181C_SOURCES= \
182	$(srcdir)/C/absmi.c $(srcdir)/C/adtdefs.c \
183	$(srcdir)/C/agc.c $(srcdir)/C/alloc.c \
184	$(srcdir)/C/amasm.c $(srcdir)/C/analyst.c \
185	$(srcdir)/C/arith0.c $(srcdir)/C/arith1.c $(srcdir)/C/arith2.c \
186	$(srcdir)/C/arrays.c \
187	$(srcdir)/C/attvar.c $(srcdir)/C/bb.c \
188	$(srcdir)/C/bignum.c \
189	$(srcdir)/C/c_interface.c $(srcdir)/C/cdmgr.c $(srcdir)/C/cmppreds.c \
190	$(srcdir)/C/clause_list.c \
191	$(srcdir)/C/compiler.c $(srcdir)/C/computils.c \
192	$(srcdir)/C/corout.c $(srcdir)/C/dbase.c $(srcdir)/C/dlmalloc.c \
193	$(srcdir)/C/errors.c \
194	$(srcdir)/C/eval.c $(srcdir)/C/exec.c \
195	$(srcdir)/C/globals.c $(srcdir)/C/gmp_support.c \
196	$(srcdir)/C/gprof.c $(srcdir)/C/grow.c \
197	$(srcdir)/C/heapgc.c $(srcdir)/C/index.c	   \
198	$(srcdir)/C/init.c $(srcdir)/C/inlines.c	   \
199	$(srcdir)/C/iopreds.c $(srcdir)/C/depth_bound.c \
200	$(srcdir)/C/load_foreign.c \
201	$(srcdir)/C/load_dl.c $(srcdir)/C/load_dld.c $(srcdir)/C/load_none.c \
202	$(srcdir)/C/load_aout.c $(srcdir)/C/load_aix.c $(srcdir)/C/load_dll.c \
203	$(srcdir)/C/load_shl.c $(srcdir)/C/load_dyld.c \
204	$(srcdir)/C/mavar.c $(srcdir)/C/modules.c $(srcdir)/C/other.c       \
205	$(srcdir)/C/parser.c \
206	$(srcdir)/C/readutil.c \
207	$(srcdir)/C/save.c $(srcdir)/C/scanner.c \
208	$(srcdir)/C/sort.c $(srcdir)/C/stdpreds.c $(srcdir)/C/sysbits.c \
209	$(srcdir)/C/threads.c \
210	$(srcdir)/C/tracer.c $(srcdir)/C/unify.c $(srcdir)/C/userpreds.c  \
211	$(srcdir)/C/udi.c \
212	$(srcdir)/packages/udi/rtree.c \
213	$(srcdir)/packages/udi/rtree_udi.c \
214	$(srcdir)/C/utilpreds.c $(srcdir)/C/write.c $(srcdir)/console/yap.c \
215	$(srcdir)/C/ypsocks.c $(srcdir)/C/ypstdio.c \
216	$(srcdir)/BEAM/eam_am.c $(srcdir)/BEAM/eam_showcode.c \
217	$(srcdir)/BEAM/eamindex.c $(srcdir)/BEAM/eamamasm.c \
218	$(srcdir)/BEAM/eam_gc.c $(srcdir)/BEAM/eam_split.c \
219	$(srcdir)/OPTYap/opt.memory.c $(srcdir)/OPTYap/opt.init.c \
220	$(srcdir)/OPTYap/opt.preds.c $(srcdir)/OPTYap/or.engine.c \
221	$(srcdir)/OPTYap/or.cowengine.c $(srcdir)/OPTYap/or.sbaengine.c \
222	$(srcdir)/OPTYap/or.threadengine.c \
223	$(srcdir)/OPTYap/or.scheduler.c $(srcdir)/OPTYap/or.cut.c \
224	$(srcdir)/OPTYap/tab.tries.c $(srcdir)/OPTYap/tab.completion.c \
225	$(srcdir)/library/mpi/mpi.c $(srcdir)/library/mpi/mpe.c \
226	$(srcdir)/library/lammpi/yap_mpi.c $(srcdir)/library/lammpi/hash.c $(srcdir)/library/lammpi/prologterms2c.c  \
227	$(srcdir)/C/cut_c.c \
228	$(srcdir)/library/dialect/swi/fli/swi.c \
229	$(srcdir)/library/dialect/swi/fli/blobs.c \
230	$(srcdir)/MYDDAS/myddas_mysql.c \
231	$(srcdir)/MYDDAS/myddas_odbc.c \
232	$(srcdir)/MYDDAS/myddas_util.c \
233	$(srcdir)/MYDDAS/myddas_initialization.c \
234	$(srcdir)/MYDDAS/myddas_shared.c \
235	$(srcdir)/MYDDAS/myddas_statistics.c \
236	$(srcdir)/MYDDAS/myddas_top_level.c \
237	$(srcdir)/MYDDAS/myddas_wkb2prolog.c
238
239PL_SOURCES= \
240	$(srcdir)/pl/arith.yap \
241	$(srcdir)/pl/arrays.yap \
242	$(srcdir)/pl/attributes.yap \
243	$(srcdir)/pl/boot.yap \
244	$(srcdir)/pl/callcount.yap\
245	$(srcdir)/pl/checker.yap $(srcdir)/pl/chtypes.yap \
246	$(srcdir)/pl/consult.yap \
247	$(srcdir)/pl/control.yap \
248	$(srcdir)/pl/corout.yap $(srcdir)/pl/debug.yap \
249	$(srcdir)/pl/depth_bound.yap \
250	$(srcdir)/pl/dialect.yap \
251	$(srcdir)/pl/directives.yap \
252	$(srcdir)/pl/eam.yap \
253	$(srcdir)/pl/eval.yap \
254	$(srcdir)/pl/errors.yap	\
255	$(srcdir)/pl/flags.yap	\
256	$(srcdir)/pl/grammar.yap \
257	$(srcdir)/pl/ground.yap \
258	$(srcdir)/pl/hacks.yap \
259	$(srcdir)/pl/init.yap \
260	$(srcdir)/pl/listing.yap \
261	$(srcdir)/pl/lists.yap \
262	$(srcdir)/pl/messages.yap \
263	$(srcdir)/pl/load_foreign.yap \
264	$(srcdir)/pl/modules.yap $(srcdir)/pl/preds.yap \
265	$(srcdir)/pl/profile.yap \
266	$(srcdir)/pl/protect.yap \
267	$(srcdir)/pl/save.yap \
268	$(srcdir)/pl/setof.yap \
269	$(srcdir)/pl/signals.yap \
270	$(srcdir)/pl/sockets.yap $(srcdir)/pl/sort.yap \
271	$(srcdir)/pl/statistics.yap \
272	$(srcdir)/pl/strict_iso.yap \
273	$(srcdir)/pl/tabling.yap $(srcdir)/pl/threads.yap \
274	$(srcdir)/pl/udi.yap \
275	$(srcdir)/pl/utils.yap \
276	$(srcdir)/pl/yapor.yap $(srcdir)/pl/yio.yap
277
278YAPDOCS=$(srcdir)/docs/yap.tex $(srcdir)/docs/chr.tex \
279	$(srcdir)/docs/clpr.tex $(srcdir)/docs/swi.tex
280
281ENGINE_OBJECTS = \
282	agc.o absmi.o adtdefs.o alloc.o amasm.o analyst.o arrays.o \
283	arith0.o arith1.o arith2.o attvar.o \
284	bignum.o bb.o \
285	cdmgr.o cmppreds.o compiler.o computils.o \
286	corout.o cut_c.o dbase.o dlmalloc.o errors.o eval.o \
287	exec.o globals.o gmp_support.o gprof.o grow.o \
288	heapgc.o index.o init.o  inlines.o \
289	iopreds.o depth_bound.o mavar.o \
290	myddas_mysql.o myddas_odbc.o myddas_shared.o myddas_initialization.o \
291	myddas_util.o myddas_statistics.o myddas_top_level.o \
292	myddas_wkb2prolog.o modules.o other.o   \
293	parser.o readutil.o save.o scanner.o sort.o stdpreds.o \
294	sysbits.o threads.o tracer.o \
295	udi.o rtree.o rtree_udi.o\
296	unify.o userpreds.o utilpreds.o \
297	write.o \
298	blobs.o swi.o ypsocks.o ypstdio.o @MPI_OBJS@
299
300C_INTERFACE_OBJECTS = \
301	load_foreign.o load_dl.o load_dld.o load_dyld.o \
302	load_none.o load_aout.o load_aix.o load_dll.o load_shl.o \
303	c_interface.o clause_list.o
304
305OR_OBJECTS = \
306	opt.memory.o opt.init.o opt.preds.o   \
307	or.engine.o or.cowengine.o or.sbaengine.o or.threadengine.o \
308	or.scheduler.o or.cut.o      \
309	tab.tries.o tab.completion.o
310
311BEAM_OBJECTS = \
312	eamamasm.o eam_showcode.o eamindex.o eam_am.o
313
314STATIC_OBJECTS = \
315	@STATIC_MODE@sys.o yap_random.o regexp.o  @NO_BUILTIN_REGEXP@ regcomp.o regerror.o regfree.o regexec.o
316
317LIB_OBJECTS = $(ENGINE_OBJECTS) $(C_INTERFACE_OBJECTS) $(OR_OBJECTS) $(BEAM_OBJECTS) $(STATIC_OBJECTS)
318
319OBJECTS = yap.o $(LIB_OBJECTS)
320
321
322
323all: parms.h startup.yss
324
325Makefile: $(srcdir)/Makefile.in
326
327$(srcdir)/H/Yap.h: config.h
328
329config.h:	parms.h
330
331parms.h:	Makefile
332		@echo "#define YAP_ROOTDIR       \"$(prefix)\""   > $@%
333		@echo "#define YAP_BINDIR	    \"$(BINDIR)\""   >> $@%
334		@echo "#define YAP_LIBDIR	    \"$(YAPLIBDIR)\""   >> $@%
335		@echo "#define YAP_SHAREDIR	    \"$(SHAREDIR)\""   >> $@%
336		@echo "#define YAP_PL_SRCDIR	    \"$(SHAREDIR)/Yap/pl\""   >> $@%
337		@echo "#define YAP_STARTUP   \"$(YAPSTARTUP)\"" >> $@%
338		@echo $(VERSION) | $(AWK) -F. '{ printf("#define YAP_VERSION %d\n", $$1 * 10000 + $$2 * 100 + $$3); }' >> $@%
339		@echo "#define MYDDAS_VERSION	    \"$(MYDDAS_VERSION)\""       >> $@%
340		@echo "#define YAP_ARCH	    \"$(ARCH)\""       >> $@%
341		@echo "#define YAP_LIBS	    \"$(LIBS)\""     >> $@%
342		@echo "#define YAP_YAPLIB	    \"$(YAPLIB)\""   >> $@%
343		@echo "#define YAP_CC	    \"$(CC)\""	       >> $@%
344		@echo "#define YAP_CFLAGS	    \"$(CFLAGS)\"" >> $@%
345		@echo "#define YAP_LDFLAGS    \"$(LDFLAGS)\""    >> $@%
346		@echo "#define YAP_SHLIB_SUFFIX    \".\" \"$(SO)\""    >> $@%
347		@echo "#define YAP_TIMESTAMP \"`date +%s`\"" >> $@%
348		@echo "#define YAP_SVERSION   \"YAP $(VERSION) ($(ARCH)): `date`\"" >> $@%
349		@if cmp -s $@% $@; then rm $@%; else mv $@% $@; fi
350
351
352#special rule for this one: we cannot use -fomit-frame-pointer because this will
353# interface with the outside world.
354c_interface.o: $(srcdir)/C/c_interface.c $(srcdir)/include/c_interface.h config.h
355	$(CC) $(C_INTERF_FLAGS) -c $(srcdir)/C/c_interface.c -o c_interface.o
356
357clause_list.o: $(srcdir)/C/clause_list.c $(srcdir)/include/clause_list.h config.h
358	$(CC) $(C_INTERF_FLAGS) -c $(srcdir)/C/clause_list.c -o clause_list.o
359
360init.o: $(srcdir)/C/init.c config.h
361	$(CC) -c $(CFLAGS) $(srcdir)/C/init.c -o $@
362
363load_foreign.o: $(srcdir)/C/load_foreign.c config.h
364	$(CC) -c $(CFLAGS) $(srcdir)/C/load_foreign.c -o $@
365
366save.o: $(srcdir)/C/save.c config.h
367	$(CC) -c $(CFLAGS) $(srcdir)/C/save.c -o $@
368
369sysbits.o: $(srcdir)/C/sysbits.c config.h
370	$(CC) -c $(CFLAGS) $(srcdir)/C/sysbits.c -o $@
371
372udi.o: $(srcdir)/C/udi.c config.h
373	$(CC) -c $(C_INTERF_FLAGS) $(srcdir)/C/udi.c -o $@
374
375rtree.o: $(srcdir)/packages/udi/rtree.c config.h
376	$(CC) -c $(C_INTERF_FLAGS) $(srcdir)/packages/udi/rtree.c -o $@
377
378rtree_udi.o: $(srcdir)/packages/udi/rtree_udi.c config.h
379	$(CC) -c $(C_INTERF_FLAGS) $(srcdir)/packages/udi/rtree_udi.c -o $@
380
381yap.o: $(srcdir)/console/yap.c config.h
382	$(CC) -c $(CFLAGS) -I$(srcdir)/include $(srcdir)/console/yap.c -o $@
383
384mpi.o: $(srcdir)/library/mpi/mpi.c config.h
385	$(MPI_CC) -c $(CFLAGS) $(srcdir)/library/mpi/mpi.c -o $@
386
387mpe.o: $(srcdir)/library/mpi/mpe.c config.h
388	$(MPI_CC) -c $(CFLAGS) $(srcdir)/library/mpi/mpe.c -o $@
389
390myddas_mysql.o: $(srcdir)/MYDDAS/myddas_mysql.c config.h
391	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_mysql.c -o $@
392
393myddas_odbc.o: $(srcdir)/MYDDAS/myddas_odbc.c config.h
394	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_odbc.c -o $@
395
396myddas_shared.o: $(srcdir)/MYDDAS/myddas_shared.c config.h
397	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_shared.c -o $@
398
399myddas_util.o: $(srcdir)/MYDDAS/myddas_util.c config.h
400	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_util.c -o $@
401
402myddas_initialization.o: $(srcdir)/MYDDAS/myddas_initialization.c config.h
403	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_initialization.c -o $@
404
405myddas_top_level.o: $(srcdir)/MYDDAS/myddas_top_level.c config.h
406	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_top_level.c -o $@
407
408myddas_wkb2prolog.o: $(srcdir)/MYDDAS/myddas_wkb2prolog.c config.h
409	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_wkb2prolog.c -o $@
410
411myddas_statistics.o: $(srcdir)/MYDDAS/myddas_statistics.c config.h
412	$(CC) -c $(CFLAGS) $(srcdir)/MYDDAS/myddas_statistics.c -o $@
413
414opt.memory.o: $(srcdir)/OPTYap/opt.memory.c config.h
415	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/opt.memory.c -o $@
416
417opt.init.o: $(srcdir)/OPTYap/opt.init.c config.h
418	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/opt.init.c -o $@
419
420opt.preds.o: $(srcdir)/OPTYap/opt.preds.c config.h
421	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/opt.preds.c -o $@
422
423or.cut.o: $(srcdir)/OPTYap/or.cut.c config.h
424	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.cut.c -o $@
425
426or.engine.o: $(srcdir)/OPTYap/or.engine.c config.h
427	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.engine.c -o $@
428
429or.cowengine.o: $(srcdir)/OPTYap/or.cowengine.c config.h
430	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.cowengine.c -o $@
431
432or.sbaengine.o: $(srcdir)/OPTYap/or.sbaengine.c config.h
433	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.sbaengine.c -o $@
434
435or.threadengine.o: $(srcdir)/OPTYap/or.threadengine.c config.h
436	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.threadengine.c -o $@
437
438or.scheduler.o: $(srcdir)/OPTYap/or.scheduler.c config.h
439	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/or.scheduler.c -o $@
440
441tab.tries.o: $(srcdir)/OPTYap/tab.tries.c config.h
442	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/tab.tries.c -o $@
443
444tab.completion.o: $(srcdir)/OPTYap/tab.completion.c config.h
445	$(CC) -c $(CFLAGS) $(srcdir)/OPTYap/tab.completion.c -o $@
446
447eam_showcode.o:  $(srcdir)/BEAM/eam_showcode.c config.h
448	$(CC) -c $(CFLAGS) $(srcdir)/BEAM/eam_showcode.c -o $@
449
450eam_am.o:  $(srcdir)/BEAM/eam_am.c config.h
451	$(CC) -c $(CFLAGS) $(srcdir)/BEAM/eam_am.c -o $@
452
453eamamasm.o:  $(srcdir)/BEAM/eamamasm.c config.h
454	$(CC) -c $(CFLAGS) $(srcdir)/BEAM/eamamasm.c -o $@
455
456eamindex.o:  $(srcdir)/BEAM/eamindex.c config.h
457	$(CC) -c $(CFLAGS) $(srcdir)/BEAM/eamindex.c -o $@
458
459sys.o: $(srcdir)/library/system/sys.c config.h
460	$(CC) -c $(CFLAGS) -I$(srcdir)/include $(srcdir)/library/system/sys.c  -o $@
461
462swi.o: $(srcdir)/library/dialect/swi/fli/swi.c  $(srcdir)/library/dialect/swi/fli/swi.h $(srcdir)/include/SWI-Prolog.h $(srcdir)/include/SWI-Stream.h config.h
463	$(CC) -c $(CFLAGS) -I$(srcdir)/include  -I$(srcdir)/library/dialect/swi/fli  $(srcdir)/library/dialect/swi/fli/swi.c  -o $@
464
465blobs.o: $(srcdir)/library/dialect/swi/fli/blobs.c  $(srcdir)/library/dialect/swi/fli/swi.h  $(srcdir)/include/SWI-Prolog.h config.h
466	$(CC) -c $(CFLAGS) -I$(srcdir)/include  -I$(srcdir)/library/dialect/swi/fli  $(srcdir)/library/dialect/swi/fli/blobs.c  -o $@
467
468yap_random.o: $(srcdir)/library/random/yap_random.c config.h
469	$(CC) -c $(CFLAGS) -I$(srcdir)/include  $(srcdir)/library/random/yap_random.c  -o $@
470
471regexp.o: $(srcdir)/library/regex/regexp.c  @NO_BUILTIN_REGEXP@ $(srcdir)/library/regex/regex2.h  $(srcdir)/library/regex/engine.c config.h
472	$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regexp.c -o regexp.o
473
474regcomp.o: $(srcdir)/library/regex/regcomp.c $(srcdir)/library/regex/regex2.h config.h
475	$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regcomp.c -o regcomp.o
476
477regerror.o: $(srcdir)/library/regex/regerror.c config.h
478	$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regerror.c -o regerror.o
479
480regfree.o: $(srcdir)/library/regex/regfree.c $(srcdir)/library/regex/regex2.h config.h
481	$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regfree.c -o regfree.o
482
483regexec.o: $(srcdir)/library/regex/regexec.c config.h
484	$(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir)/library/regex $(srcdir)/library/regex/regexec.c -o regexec.o
485
486# default rule
487%.o : $(srcdir)/C/%.c config.h
488	$(CC) -c $(CFLAGS) $< -o $@
489
490
491## CPP'ed files (for macro debugging)
492
493%.i : $(srcdir)/C/%.c
494	$(CC) -E $< $(CFLAGS) > $@
495
496absmi.i: $(srcdir)/C/absmi.c
497	$(CC) -E $(CFLAGS) $(ABSMI_FLAGS) $(srcdir)/C/absmi.c > $@
498
499c_interface.i: $(srcdir)/C/c_interface.c $(srcdir)/include/c_interface.h
500	$(CC) -E $(C_INTERF_FLAGS) $(srcdir)/C/c_interface.c > $@
501#
502
503mycb: $(srcdir)/mycb.c
504	$(CC) $(CFLAGS) $(srcdir)/mycb.c -o mycb
505
506all: startup.yss
507	@INSTALL_DLLS@ (cd packages/PLStream; $(MAKE))
508	@INSTALL_DLLS@ (cd library/lammpi; $(MAKE))
509	@INSTALL_MATLAB@ (cd library/matlab; $(MAKE))
510	@INSTALL_DLLS@ (cd library/matrix; $(MAKE))
511	@INSTALL_DLLS@ (cd library/random; $(MAKE))
512	@INSTALL_DLLS@ (cd library/regex; $(MAKE))
513	@INSTALL_DLLS@ (cd library/rltree; $(MAKE))
514	@INSTALL_DLLS@ (cd library/system; $(MAKE))
515	@INSTALL_DLLS@ (cd library/tries; $(MAKE))
516	@INSTALL_DLLS@ (cd packages/clib; $(MAKE))
517	@INSTALL_DLLS@ (cd packages/http; $(MAKE))
518	@INSTALL_DLLS@ (cd packages/plunit; $(MAKE))
519	@INSTALL_DLLS@ (cd packages/RDF; $(MAKE))
520	@INSTALL_DLLS@ (cd packages/semweb; $(MAKE))
521	@INSTALL_DLLS@ (cd packages/sgml; $(MAKE))
522	@USE_MINISAT@ (cd packages/swi-minisat2/C; $(MAKE))
523	@INSTALL_DLLS@ (cd packages/tai; $(MAKE))
524	@INSTALL_DLLS@ (cd packages/zlib; $(MAKE))
525	@ENABLE_CPLINT@ (cd packages/cplint/approx/simplecuddLPADs; $(MAKE))
526	@ENABLE_CPLINT@ (cd packages/cplint/slipcase; $(MAKE))
527	@ENABLE_CPLINT@ (cd packages/cplint; $(MAKE))
528	@USE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE))
529	@USE_CUDD@ (cd packages/ProbLog/simplecudd_lfi; $(MAKE))
530	@ENABLE_JPL@ @INSTALL_DLLS@ (cd packages/jpl; $(MAKE))
531
532startup.yss: yap@EXEC_SUFFIX@ $(PL_SOURCES)
533	-rm -f startup.yss
534	echo "bootstrap('$(srcdir)/pl/init.yap'). module(user). save_program('startup.yss')." |  @PRE_INSTALL_ENV@ ./yap -b $(srcdir)/pl/boot.yap
535
536yap@EXEC_SUFFIX@: $(HEADERS) yap.o @YAPLIB@
537	$(MPI_CC) $(EXECUTABLE_CFLAGS) $(LDFLAGS) -o yap yap.o @YAPLIB@ $(LIBS) @MPI_LIBS@
538
539libYap.a: $(LIB_OBJECTS)
540	-rm -f libYap.a
541	$(AR) rc libYap.a $(LIB_OBJECTS)
542	$(RANLIB) libYap.a
543
544@DYNYAPLIB@: $(LIB_OBJECTS)
545	@YAPLIB_LD@ -o @YAPLIB@ $(LIB_OBJECTS) $(LIBS) $(LDFLAGS) $(SONAMEFLAG)
546
547install: install_bin install_data
548
549install_bin: @INSTALL_COMMAND@
550
551install_unix: startup.yss libYap.a
552	mkdir -p $(DESTDIR)$(BINDIR)
553	$(INSTALL_PROGRAM) -m 755 yap@EXEC_SUFFIX@ $(DESTDIR)$(BINDIR)/yap
554	mkdir -p $(DESTDIR)$(YAPLIBDIR)
555	$(INSTALL_DATA) startup.yss $(DESTDIR)$(YAPLIBDIR)/startup.yss
556	@INSTALL_DLLS@ $(INSTALL_DATA) -m 755 @YAPLIB@ $(DESTDIR)$(LIBDIR)
557	mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
558	mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/pl
559	mkdir -p $(DESTDIR)$(DOCSDIR)
560	$(INSTALL) $(srcdir)/Artistic $(DESTDIR)$(DOCSDIR)
561	$(INSTALL) $(srcdir)/README $(DESTDIR)$(DOCSDIR)
562	$(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR)
563	for f in $(PL_SOURCES); do $(INSTALL) $$f $(DESTDIR)$(SHAREDIR)/Yap/pl; done
564	@INSTALL_DLLS@ (cd packages/PLStream; $(MAKE) install)
565	@INSTALL_DLLS@ (cd library/lammpi; $(MAKE) install)
566	@INSTALL_DLLS@ (cd library/matrix; $(MAKE) install)
567	@INSTALL_DLLS@ (cd library/random; $(MAKE) install)
568	@INSTALL_DLLS@ (cd library/regex; $(MAKE) install)
569	@INSTALL_DLLS@ (cd library/rltree; $(MAKE) install)
570	@INSTALL_DLLS@ (cd library/system; $(MAKE) install)
571	@INSTALL_DLLS@ (cd library/tries; $(MAKE) install)
572	@INSTALL_DLLS@ (cd packages/clib; $(MAKE) install)
573	@INSTALL_DLLS@ (cd packages/http; $(MAKE) install)
574	@INSTALL_DLLS@ (cd packages/plunit; $(MAKE) install)
575	@INSTALL_DLLS@ (cd packages/sgml; $(MAKE) install)
576	@INSTALL_DLLS@ (cd packages/RDF; $(MAKE) install)
577	@INSTALL_DLLS@ (cd packages/semweb; $(MAKE) install)
578	@INSTALL_DLLS@ (cd packages/tai; $(MAKE) install)
579	@INSTALL_DLLS@ (cd packages/zlib; $(MAKE) @ZLIB_INSTALL@)
580	@USE_MINISAT@ (cd packages/swi-minisat2/C; $(MAKE) install)
581	@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) install)
582	@ENABLE_JPL@ @INSTALL_DLLS@ (cd packages/jpl; $(MAKE) install)
583	#@ENABLE_JPL@ @INSTALL_DLLS@ (cd packages/pyswip; $(MAKE) install)
584	mkdir -p $(DESTDIR)$(INCLUDEDIR)
585	$(INSTALL) $(HEADERS) $(DESTDIR)$(INCLUDEDIR)
586	for h in $(INTERFACE_HEADERS); do $(INSTALL) $$h $(DESTDIR)$(INCLUDEDIR); done
587	$(INSTALL) config.h $(DESTDIR)$(INCLUDEDIR)/config.h
588	$(INSTALL) parms.h $(DESTDIR)$(INCLUDEDIR)/parms.h
589	@ENABLE_CPLINT@ (cd packages/cplint; $(MAKE) install)
590#	@ENABLE_CPLINT@ (cd packages/cplint/approx/simplecuddLPADs; $(MAKE) install)
591#	@ENABLE_CPLINT@ (cd packages/cplint/slipcase; $(MAKE) install)
592	@USE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE) install)
593	@USE_CUDD@ (cd packages/ProbLog/simplecudd_lfi; $(MAKE) install)
594
595
596install_win32: startup.yss
597	mkdir -p $(DESTDIR)$(BINDIR)
598	mkdir -p $(DESTDIR)$(LIBDIR)
599	mkdir -p $(DESTDIR)$(YAPLIBDIR)
600	mkdir -p $(DESTDIR)$(INCLUDEDIR)
601	$(INSTALL_PROGRAM) -m 755 yap.exe $(DESTDIR)$(BINDIR)/yap.exe
602	$(INSTALL_PROGRAM) -m 755 yap.dll $(DESTDIR)$(BINDIR)/yap.dll
603	$(INSTALL_PROGRAM) -m 755 @YAPLIB@ $(DESTDIR)$(YAPLIBDIR)/@YAPLIB@
604	$(INSTALL_PROGRAM) -m 755 startup.yss $(DESTDIR)$(YAPLIBDIR)/startup.yss
605	mkdir -p $(DESTDIR)$(SHAREDIR)/Yap
606	mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/pl
607	mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/swi
608	mkdir -p $(DESTDIR)$(DOCSDIR)
609	$(INSTALL) $(srcdir)/Artistic $(DESTDIR)$(DOCSDIR)
610	$(INSTALL) $(srcdir)/README $(DESTDIR)$(DOCSDIR)/README.TXT
611	$(INSTALL) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR)/COPYING.TXT
612	for f in $(PL_SOURCES); do $(INSTALL) $$f $(DESTDIR)$(SHAREDIR)/Yap/pl; done
613	$(INSTALL) $(HEADERS) $(DESTDIR)$(INCLUDEDIR)
614	for h in $(INTERFACE_HEADERS); do $(INSTALL) $$h $(DESTDIR)$(INCLUDEDIR); done
615	$(INSTALL) config.h $(DESTDIR)$(INCLUDEDIR)/config.h
616	$(INSTALL) parms.h $(DESTDIR)$(INCLUDEDIR)/parms.h
617	(cd library/random; $(MAKE) install)
618	(cd library/matrix; $(MAKE) install)
619	(cd library/regex; $(MAKE) install)
620	(cd library/rltree; $(MAKE) install)
621	(cd library/system; $(MAKE) install)
622	@ENABLE_WINCONSOLE@ (cd LGPL/swi_console; $(MAKE) install)
623	@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) install)
624	(cd library/tries; $(MAKE) install)
625	(cd packages/PLStream; $(MAKE) install)
626	(cd packages/tai; $(MAKE) install)
627	(cd packages/clib; $(MAKE) install)
628	(cd packages/plunit; $(MAKE) install)
629	(cd packages/http; $(MAKE) install)
630	(cd packages/RDF; $(MAKE) install)
631	(cd packages/sgml; $(MAKE) install)
632	(cd packages/semweb; $(MAKE) install)
633	(cd packages/zlib; $(MAKE) @ZLIB_INSTALL@)
634	@ENABLE_JPL@ (cd packages/jpl ; $(MAKE) install)
635	@USE_MINISAT@ (cd packages/swi-minisat2/C; $(MAKE) install)
636	@ENABLE_CPLINT@ (cd packages/cplint; $(MAKE) install)
637	@USE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE) install)
638	@USE_CUDD@ (cd packages/ProbLog/simplecudd_lfi; $(MAKE) install)
639
640install_library: @YAPLIB@
641	mkdir -p $(DESTDIR)$(INCLUDEDIR)
642	for h in $(HEADERS); do $(INSTALL) $$h $(DESTDIR)$(INCLUDEDIR); done
643
644install_data: install_copied_files install_bin
645	@ENABLE_CHR@ (cd packages/chr ; $(MAKE) install)
646	@ENABLE_CHR@ (cd packages/clpqr ; $(MAKE) install)
647
648install_copied_files:
649	(cd library ; $(MAKE) install)
650	(cd packages/swi-minisat2; $(MAKE) install)
651	(cd LGPL ; $(MAKE) install)
652	(cd GPL ; $(MAKE) install)
653	$(INSTALL_DATA) $(srcdir)/LGPL/pillow/icon_address.pl $(DESTDIR)$(SHAREDIR)/Yap/
654	$(INSTALL_DATA) $(srcdir)/LGPL/pillow/pillow.pl $(DESTDIR)$(SHAREDIR)/Yap/
655	@INSTALLCLP@(cd LGPL/clp ; $(MAKE) install)
656	(cd packages/CLPBN ; $(MAKE) install)
657	(cd  packages/ProbLog ; $(MAKE) install)
658
659##########
660TAGS: $(C_SOURCES) $(PL_SOURCES) $(HEADERS)
661	etags  $(C_SOURCES)  $(PL_SOURCES) $(HEADERS)
662
663depend: $(HEADERS) $(C_SOURCES)
664	-@if test "$(GCC)" = yes; then\
665	  $(CC) -MM $(CFLAGS) -I$(srcdir)/include $(C_SOURCES) >> Makefile;\
666	else\
667          makedepend -f - -- $(CFLAGS) -I$(srcdir)/include -- $(C_SOURCES) |\
668          sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\
669	fi
670
671clean: clean_docs
672	rm -f *.o *~ *.BAK *.a
673	@INSTALL_DLLS@ (cd packages/PLStream; $(MAKE) clean)
674	@INSTALL_DLLS@ (cd library/lammpi; $(MAKE) clean)
675	@INSTALL_MATLAB@ (cd library/matlab; $(MAKE) clean)
676	@INSTALL_DLLS@ (cd library/matrix; $(MAKE) clean)
677	@INSTALL_DLLS@ (cd library/random; $(MAKE) clean)
678	@INSTALL_DLLS@ (cd library/regex; $(MAKE) clean)
679	@INSTALL_DLLS@ (cd library/rltree; $(MAKE) clean)
680	@INSTALL_DLLS@ (cd library/system; $(MAKE) clean)
681	@INSTALL_DLLS@ (cd library/tries; $(MAKE) clean)
682	@INSTALL_DLLS@ (cd packages/clib; $(MAKE) clean)
683	@INSTALL_DLLS@ (cd packages/http; $(MAKE) clean)
684	@INSTALL_DLLS@ (cd packages/plunit; $(MAKE) clean)
685	@INSTALL_DLLS@ (cd packages/RDF; $(MAKE) clean)
686	@INSTALL_DLLS@ (cd packages/semweb; $(MAKE) clean)
687	@INSTALL_DLLS@ (cd packages/sgml; $(MAKE) clean)
688	@USE_MINISAT@ (cd packages/swi-minisat2; $(MAKE) clean)
689	@INSTALL_DLLS@ (cd packages/tai; $(MAKE) clean)
690	@INSTALL_DLLS@ (cd packages/zlib; $(MAKE) clean)
691	@ENABLE_CPLINT@ (cd packages/cplint/approx/simplecuddLPADs; $(MAKE) clean)
692	@ENABLE_CPLINT@ (cd packages/cplint; $(MAKE) clean)
693	@USE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE) clean)
694	@USE_CUDD@ (cd packages/ProbLog/simplecudd_lfi; $(MAKE) clean)
695	@ENABLE_JPL@ @INSTALL_DLLS@ (cd packages/jpl; $(MAKE) clean)
696
697
698
699realclean: clean realclean_docs
700	rm -f yap@EXEC_SUFFIX@ startup.yss config.log config.cache config.h
701
702dist:
703
704.c.s:
705	$(CC) $(CFLAGS) -S $<
706
707# use my own .def file.
708libWYap.a: yap.dll
709	dlltool --def $(srcdir)/misc/yap.def \
710	--dllname yap.dll \
711	--output-lib libWYap.a
712
713yap.dll:  libYap.a
714	$(CC) $(CFLAGS) -shared -o yap.dll \
715	-Wl,--export-all-symbols \
716	-Wl,--enable-auto-import \
717	-Wl,--whole-archive libYap.a \
718	-Wl,--no-whole-archive $(LIBS) $(LDFLAGS)
719
720install_info:
721	$(MAKE) info; \
722	$(INSTALL) yap.info* $(DESTDIR)$(INFODIR); \
723	if test -e $(DESTDIR)$(INFODIR)/emacs.bz2; then \
724	  bzip2 --quiet --force $(DESTDIR)$(INFODIR)/yap.info*; \
725	else \
726	  if test -e $(DESTDIR)$(INFODIR)/emacs.gz; then \
727	  gzip --quiet --force $(DESTDIR)$(INFODIR)/yap.info*; \
728	  fi \
729	fi; \
730	$(INSTALL_INFO) --quiet --section "Programming Languages" yap.info $(DESTDIR)$(INFODIR)/dir; \
731	cd $(srcdir)/LGPL/pillow/doc ; \
732	$(INSTALL) pillow_doc.info $(DESTDIR)$(INFODIR); \
733	if test -e $(DESTDIR)$(INFODIR)/emacs.bz2; then \
734	  bzip2 --quiet --force $(DESTDIR)$(INFODIR)/pillow_doc.info; \
735	else \
736	  if test -e $(DESTDIR)$(INFODIR)/emacs.gz; then \
737	  gzip --quiet --force $(DESTDIR)$(INFODIR)/pillow_doc.info; \
738	  fi \
739	fi; \
740	$(INSTALL_INFO) --quiet --section "Programming Languages" --entry="`cat pillow_doc.infoindex`" --info-dir=$(DESTDIR)$(INFODIR) pillow_doc.info
741
742install_docs:
743	$(MAKE) pdf
744	$(MAKE) html
745	$(INSTALL_DATA) yap.html* $(DESTDIR)$(DOCSDIR)
746	$(INSTALL_DATA) yap.pdf $(DESTDIR)$(DOCSDIR)
747	$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(DOCSDIR)
748	$(INSTALL_DATA) $(srcdir)/Artistic $(DESTDIR)$(DOCSDIR)
749	$(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(DOCSDIR)
750	$(INSTALL_DATA) $(srcdir)/changes4.3.html $(DESTDIR)$(DOCSDIR)
751	$(INSTALL_DATA) $(srcdir)/changes-5.0.html $(DESTDIR)$(DOCSDIR)
752	$(INSTALL_DATA) $(srcdir)/changes-5.1.html $(DESTDIR)$(DOCSDIR)
753	$(INSTALL_DATA) $(srcdir)/changes-6.0.html $(DESTDIR)$(DOCSDIR)
754
755
756info: yap.info
757
758yap.info: $(YAPDOCS)
759	$(MAKEINFO)  $(srcdir)/docs/yap.tex
760
761html: yap.html
762
763yap.html: $(srcdir)/docs/yap.tex
764	$(TEXI2HTML) $(srcdir)/docs/yap.tex
765
766dvi: yap.dvi
767
768yap.dvi: $(YAPDOCS)
769	$(TEXI2DVI) $(srcdir)/docs/yap.tex
770
771ps:	yap.ps
772
773yap.ps:  $(YAPDOCS)
774	dvips -o yap.ps $(srcdir)/docs/yap
775
776pdf: yap.pdf
777
778yap.pdf:  $(YAPDOCS)
779	-$(TEXI2PDF) $(srcdir)/docs/yap.tex
780
781clean_docs:
782	rm -f *.aux *.ca *.cas *.cn *.cns *.cp *.cps *.cy *.cys *.dvi *.fn *.fns *.ky *.log *.sa *.sas *.sn *.sns *.sy *.sys *~ *.tp *.vr *.toc *.pg
783
784realclean_docs: clean_docs
785	rm -f yap.ps yap.html yap_toc.html yap.pdf yap.info*
786
787installcheck:
788	@ENABLE_CPLINT@ (cd packages/cplint; $(MAKE) installcheck)
789
790
791# DO NOT DELETE THIS LINE -- make depend depends on it.
792
793