File: Makefile.mak

package info (click to toggle)
swi-prolog 6.6.6-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 82,312 kB
  • sloc: ansic: 322,250; perl: 245,822; sh: 6,651; java: 5,254; makefile: 4,423; cpp: 4,153; ruby: 1,594; yacc: 843; xml: 82; sed: 12; sql: 6
file content (425 lines) | stat: -rw-r--r-- 12,680 bytes parent folder | download | duplicates (2)
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
################################################################
# Makefile for SWI-Prolog on MS-Windows
#
# Author:			Jan Wielemaker
#			     J.Wielemaker@cs.vu.nl
#		University of Amsterdam  VU University Amsterdam
#		Kruislaan 419		 De Boelelaan 181a
#		1098 VA  Amsterdam	 1081 HV Amsterdam
#			       The Netherlands
#
# Public targets:
#
#	* make			Simply makes all programs in the current tree
#	* make install		Installs the libraries and public executables
#	* make install-arch	Install machine dependent files
#	* make install-libs	Install machine independent files
#
# Copyright (C) University of Amsterdam
#
# Copyright policy:
#
#	* LGPL (see file COPYING or http://www.gnu.org/)
################################################################

# NOTE: The Unix/GCC versions use profile-based optimization.  This is
# also available for MSVC2005, but not for the Express version. It is
# called `POGO'. See
# http://blogs.msdn.com/vcblog/archive/2008/11/12/pogo.aspx

STACK=4000000

PLHOME=..
!include rules.mk
!include common.mk

PL=pl
PLCON=$(PLHOME)\bin\swipl.exe
PLWIN=$(PLHOME)\bin\swipl-win.exe
PLLD=$(PLHOME)\bin\swipl-ld.exe
PLRC=$(PLHOME)\bin\swipl-rc.exe
PLDLL=$(PLHOME)\bin\swipl.dll
TERMDLL=$(PLHOME)\bin\plterm.dll
OUTDIRS=$(PLHOME)\bin $(PLHOME)\lib $(PLHOME)\include

LOCALLIB=$(UXLIB) rc/rc.lib libtai/tai.lib

PB=$(PLHOME)\boot
INCLUDEDIR=$(PLHOME)\include
CINCLUDE=$(INCLUDEDIR)\SWI-Prolog.h
STREAMH=$(INCLUDEDIR)\SWI-Stream.h
STARTUPPATH=$(PLHOME)\$(PLBOOTFILE)
LIBRARYDIR=$(PLBASE)\library

OBJ=	$(OBJ:.o=.obj) $(OSOBJ:.o=.obj) pl-nt.obj pl-ntconsole.obj pl-dde.obj

PLINIT=	$(PB)/init.pl

INCSRC=	pl-index.c pl-alloc.c pl-fli.c
SRC=	$(OBJ:.o=.c) $(DEPOBJ:.o=.c) $(EXT:.o=.c) $(INCSRC)
HDR=	config.h parms.h pl-buffer.h pl-ctype.h pl-incl.h SWI-Prolog.h \
	pl-main.h pl-os.h pl-data.h
VMI=	pl-jumptable.ic pl-codetable.c pl-vmi.h

PLSRC=$(PLSRC) ../boot/menu.pl
PLWINLIBS= wise.pl dde.pl progman.pl win_menu.pl
PLLIBS=$(PLLIBS) $(PLWINLIBS)
CLP=	bounds.pl clp_events.pl clp_distinct.pl simplex.pl clpfd.pl
UNICODE=blocks.pl unicode_data.pl
MANDIR= "$(PLBASE)\doc\Manual"

all:	lite packages

remake-all: distclean all install

lite:	banner \
	headers	swipl.home subdirs vmi \
	$(PLCON) startup index $(PLWIN) $(PLLD)

plcon:	$(PLCON)
plwin:	$(PLWIN)

system:		$(PLCON)
startup:	$(STARTUPPATH)
headers:	$(CINCLUDE) $(STREAMH)

banner:
		@echo ****************
		@echo Making SWI-Prolog $(PLVERSION) for $(PLARCH)
		@echo To be installed in $(PLBASE)
!IF "$(DBG)" == "true"
		@echo *** Compiling version for DEBUGGING
!ENDIF
!IF "$(MT)" == "true"
		@echo *** Building MULTI-Threading version
!ENDIF
		@echo ****************

$(PLLIB):	$(OBJ) $(LOCALLIB)
		$(LD) $(LDFLAGS) /dll /out:$(PLDLL) /implib:$@ $(OBJ) $(LOCALLIB) $(GMPLIB) $(LIBS) winmm.lib $(DBGLIBS)

# We first create swipl.exe  to  avoid   overriding  the  debug files of
# swipl.dll. Maybe using the same name for a   dll and exe is a bad idea
# afterall?

$(PLCON):	$(PLLIB) pl-main.obj
		$(LD) $(LDFLAGS) /subsystem:console /out:plcon.exe pl-main.obj $(PLLIB)
		editbin /stack:$(STACK) plcon.exe
		copy plcon.exe $@
		if exist plcon.exe.manifest copy plcon.exe.manifest $@.manifest

$(PLWIN):	$(PLLIB) pl-ntmain.obj swipl.res
		$(LD) $(LDFLAGS) /subsystem:windows /out:$@ pl-ntmain.obj $(PLLIB) $(TERMLIB) swipl.res $(LIBS)
		editbin /stack:$(STACK) $(PLWIN)

swipl.res:	swipl.rc swipl.ico
		$(RSC) /fo$@ swipl.rc

$(STARTUPPATH):	$(PLINIT) $(PLSRC) $(PLCON)
		$(PLCON) -O -o $(STARTUPPATH) -b $(PLINIT)

$(OUTDIRS):
		if not exist "$@/$(NULL)" $(MKDIR) "$@"

subdirs:	$(OUTDIRS)
		chdir os\windows & $(MAKE)
		chdir win32\console & $(MAKE)
		chdir rc & $(MAKE)
		chdir libtai & $(MAKE)

index:
		$(PLCON) -x $(STARTUPPATH) \
			-f none -F none \
			-g make_library_index('../library') \
			-t halt

$(CINCLUDE):	$(OUTDIRS) SWI-Prolog.h
		copy SWI-Prolog.h $@

$(STREAMH):	os\SWI-Stream.h $(INCLUDEDIR)
		copy os\SWI-Stream.h $@

$(OBJ):		pl-vmi.h
pl-funct.obj:	pl-funct.ih
pl-atom.obj:	pl-funct.ih
pl-wam.obj:	pl-vmi.c pl-alloc.c pl-index.c pl-fli.c pl-jumptable.ic
pl-prims.obj:	pl-termwalk.c
pl-rec.obj:	pl-termwalk.c
pl-stream.obj:	popen.c
pl-dtoa.obj:	dtoa.c
pl-arith.obj:	pl-segstack.h

# this should be pl-vmi.h, but that causes a recompile of everything.
# Seems NMAKE dependency computation is broken ...
vmi:		pl-vmi.c mkvmi.exe
		mkvmi.exe
		echo "ok" > vmi

pl-funct.ih:	ATOMS defatom.exe
		defatom.exe

pl-atom.ih:	ATOMS defatom.exe
		defatom.exe

defatom.exe:	defatom.obj
		$(LD) /out:$@ /subsystem:console defatom.obj $(LIBS)

mkvmi.exe:	mkvmi.obj
		$(LD) /out:$@ /subsystem:console mkvmi.obj $(LIBS)

$(PLLD):	swipl-ld.obj
		$(LD) /out:$@ /subsystem:console swipl-ld.obj $(LIBS) $(UXLIB)

tags:		TAGS

TAGS:		$(SRC)
		$(ETAGS) $(SRC) $(HDR)

swipl.home:
		echo . > $@

check:
		$(PLCON) -f test.pl -F none -g test,halt -t halt(1)

################################################################
# Installation.
################################################################

install::	install-arch install-libs install-readme install_packages \
		xpce_packages install-custom install-demo html-install

embed-manifests::
		win32\embed_manifests.cmd

install-arch:	idirs iprog
		$(INSTALL_PROGRAM) $(PLLD)  "$(BINDIR)"
		$(INSTALL_PROGRAM) $(PLRC)  "$(BINDIR)"
		$(INSTALL_DATA) $(PLLIB) "$(LIBDIR)"
		$(INSTALL_DATA) $(TERMLIB) "$(LIBDIR)"

iprog:		embed-manifests
		$(INSTALL_PROGRAM) $(PLWIN) "$(BINDIR)"
		$(INSTALL_PROGRAM) $(PLCON) "$(BINDIR)"
		$(INSTALL_PROGRAM) $(PLDLL) "$(BINDIR)"
		$(INSTALL_PROGRAM) $(TERMDLL) "$(BINDIR)"
!IF "$(PDB)" == "true"
		$(INSTALL_PROGRAM) ..\bin\swipl.pdb "$(BINDIR)"
		$(INSTALL_PROGRAM) ..\bin\swipl-win.pdb "$(BINDIR)"
		$(INSTALL_PROGRAM) ..\bin\swipl.pdb "$(BINDIR)"
		$(INSTALL_PROGRAM) ..\bin\plterm.pdb "$(BINDIR)"
!ENDIF
!IF "$(MT)" == "true"
		@echo Installing pthreadVC.dll
		$(INSTALL_PROGRAM) "$(EXTRALIBDIR)\$(LIBPTHREAD).dll" "$(BINDIR)"
		$(INSTALL_DATA) "$(EXTRALIBDIR)\$(LIBPTHREAD).lib" "$(LIBDIR)"
!ENDIF
!IF "$(MSVCRT)" != ""
		@echo Adding MSVC runtime
		$(INSTALL_PROGRAM) "$(MSVCRTDIR)\$(MSVCRT)" "$(BINDIR)"
!ENDIF

install-libs:	idirs iinclude iboot ilib
		$(INSTALL_DATA) $(STARTUPPATH) "$(PLBASE)\$(BOOTFILE)"
		$(INSTALL_DATA) swipl.home "$(PLBASE)"
		chdir "$(PLBASE)\library" & \
		   $(PLCON) \
			-f none \
			-g make_library_index('.') \
			-t halt

install-demo:	idirs
		$(INSTALL_DATA) ..\demo\likes.pl "$(PLBASE)\demo"
		$(INSTALL_DATA) ..\demo\README "$(PLBASE)\demo\README.TXT"

IDIRS=		"$(BINDIR)" "$(LIBDIR)" "$(PLBASE)\include" \
		"$(PLBASE)\include\sicstus" \
		"$(PLBASE)\include\Yap" \
		"$(PLBASE)\boot" "$(PLBASE)\library" "$(PKGDOC)" \
		"$(PLCUSTOM)" "$(PLBASE)\demo" "$(PLBASE)\library\clp" \
		"$(PLBASE)\library\dialect" "$(PLBASE)\library\dialect\yap" \
		"$(PLBASE)\library\dialect\swi" \
		"$(PLBASE)\library\dialect\iso" \
		"$(PLBASE)\library\dialect\sicstus" \
		"$(PLBASE)\library\dialect\ciao" \
		"$(PLBASE)\library\dialect\ciao\engine" \
		"$(PLBASE)\library\unicode" \
		"$(PLBASE)\library\dcg" \
		$(MANDIR)

$(IDIRS):
		if not exist $@/$(NULL) $(MKDIR) $@

idirs:		$(IDIRS)

iboot:
		chdir $(PLHOME)\boot & copy *.pl "$(PLBASE)\boot"
		copy win32\misc\mkboot.bat "$(PLBASE)\bin\mkboot.bat"

ilib:		iclp idcg idialect iswi iyap isicstus iciao iiso iunicode
		chdir $(PLHOME)\library & \
			for %f in ($(PLLIBS)) do copy %f "$(PLBASE)\library"

iclp::
		chdir $(PLHOME)\library\clp & \
			for %f in ($(CLP)) do copy %f "$(PLBASE)\library\clp"

idcg::
		chdir $(PLHOME)\library\dcg & \
			for %f in ($(DCG)) do copy %f "$(PLBASE)\library\dcg"

idialect:	iyap
		chdir $(PLHOME)\library\dialect & \
			for %f in ($(DIALECT)) do copy %f "$(PLBASE)\library\dialect"

iswi::
		chdir $(PLHOME)\library\dialect\swi & \
			for %f in ($(SWI)) do copy %f "$(PLBASE)\library\dialect\swi"

iyap::
		chdir $(PLHOME)\library\dialect\yap & \
			for %f in ($(YAP)) do copy %f "$(PLBASE)\library\dialect\yap"
		copy compat\YapInterface.h "$(PLBASE)\include\Yap\YapInterface.h"

isicstus::
		chdir $(PLHOME)\library\dialect\sicstus & \
			for %f in ($(SICSTUS)) do copy %f "$(PLBASE)\library\dialect\sicstus"
		copy compat\sicstus.h "$(PLBASE)\include\sicstus\sicstus.h"

iciao::
		chdir $(PLHOME)\library\dialect\ciao & \
			for %f in ($(CIAO)) do copy %f "$(PLBASE)\library\dialect\ciao"
		chdir $(PLHOME)\library\dialect\ciao\engine & \
			for %f in ($(CIAO_ENGINE)) do copy %f "$(PLBASE)\library\dialect\ciao\engine"
		chdir $(PLHOME)\library\dialect\ciao\regtypes & \
			for %f in ($(CIAO_REGTYPES)) do copy %f "$(PLBASE)\library\dialect\ciao\regtypes"

iiso::
		chdir $(PLHOME)\library\dialect\iso & \
			for %f in ($(ISO)) do copy %f "$(PLBASE)\library\dialect\iso"

iunicode::
		chdir $(PLHOME)\library\unicode & \
		  for %f in ($(UNICODE)) do copy %f "$(PLBASE)\library\unicode"

iinclude:
		$(INSTALL_DATA) $(PLHOME)\include\SWI-Prolog.h "$(PLBASE)\include"
		$(INSTALL_DATA) $(PLHOME)\include\SWI-Stream.h "$(PLBASE)\include"
		$(INSTALL_DATA) $(PLHOME)\include\console.h "$(PLBASE)\include\plterm.h"
!IF "$(MT)" == "true"
		$(INSTALL_DATA) "$(EXTRAINCDIR)\pthread.h" "$(PLBASE)\include"
		$(INSTALL_DATA) "$(EXTRAINCDIR)\sched.h" "$(PLBASE)\include"
		$(INSTALL_DATA) "$(EXTRAINCDIR)\semaphore.h" "$(PLBASE)\include"
!ENDIF

install-readme::
		$(INSTALL_DATA) ..\README "$(PLBASE)\README.TXT"
		$(INSTALL_DATA) ..\VERSION "$(PLBASE)"
		$(INSTALL_DATA) swipl.ico "$(PLBASE)"
		$(INSTALL_DATA) ..\COPYING "$(PLBASE)\COPYING.TXT"
		$(INSTALL_DATA) ..\man\windows.html "$(PLBASE)\doc"

install-custom::
		$(INSTALL_DATA) ..\customize\dotplrc "$(PLCUSTOM)\pl.ini"
		$(INSTALL_DATA) ..\customize\dotxpcerc "$(PLCUSTOM)\xpce.ini"
		$(INSTALL_DATA) ..\customize\README "$(PLCUSTOM)\README.TXT"

html-install::
		copy ..\man\Manual\*.html $(MANDIR) > nul
		copy ..\man\Manual\*.gif $(MANDIR) > nul


################################################################
# INSTALLER
################################################################

installer::
		$(INSTALL_DATA) win32\installer\options.ini "$(PLBASE)\.."
		$(INSTALL_DATA) win32\installer\pl.nsi "$(PLBASE)\.."
		$(INSTALL_DATA) win32\installer\mkinstaller.pl "$(PLBASE)\.."
		"$(NSIS)" $(NSISDEFS) "$(PLBASE)\..\pl.nsi"


################################################################
# Build and install packages
################################################################

packages:
		@for %p in ($(PKGS)) do \
		   @if exist "$(PKGDIR)\%p" \
		      $(CMD) /c "echo PACKAGE %p ... & chdir $(PKGDIR)\%p & $(MAKE)" || exit 1

install_packages:
		@for %p in ($(PKGS)) do \
		   @if exist "$(PKGDIR)\%p" \
		      $(CMD) /c "chdir $(PKGDIR)\%p & $(MAKE) install" || exit 1
!IF "$(CFG)" == "dev"
		@for %p in ($(PKGS)) do \
		   if exist "$(PKGDIR)\%p" \
		      $(CMD) /c "chdir $(PKGDIR)\%p & $(MAKE) html-install" || exit 1
		if exist $(PKGDIR)\index.html \
		    copy $(PKGDIR)\index.html "$(PKGDOC)"
!ENDIF

xpce_packages:
		@for %p in ($(PKGS)) do \
		   @if exist "$(PKGDIR)\%p" \
		      $(CMD) /c "chdir $(PKGDIR)\%p & $(MAKE) xpce-install" || exit 1

clean_packages:
		for %p in ($(PKGS)) do \
		   if exist "$(PKGDIR)\%p" \
		      $(CMD) /c "chdir $(PKGDIR)\%p & $(MAKE) clean" || exit 1

distclean_packages:
		for %p in ($(PKGS)) do \
		   if exist "$(PKGDIR)\%p" \
		      $(CMD) /c "chdir $(PKGDIR)\%p & $(MAKE) distclean" || exit 1


################################################################
# Quick common actions during development
################################################################

pce-dll::
		$(CMD) /c "chdir $(PKGDIR)\xpce\src & $(MAKE) idll"
clib-install::
		$(CMD) /c "chdir $(PKGDIR)\clib & $(MAKE) install"
odbc-install:
		$(CMD) /c "chdir $(PKGDIR)\odbc & $(MAKE) install"


################################################################
# Redistributable Requirements .cab files
################################################################

# To update the reqs-N-BITS.cab, do this:
#
# Extract the old one, update the files and update files.txt
# Then run
#
# cabarc.exe -p n reqs-N-BITS.cab @files.txt

################################################################
# Cleanup
################################################################

clean:		clean_packages
		chdir rc & $(MAKE) clean
		chdir libtai & $(MAKE) clean
		chdir os\windows & $(MAKE) clean
		chdir win32\console & $(MAKE) clean
		-del *.manifest *.obj os\*.obj *~ pl.res vmi 2>nul

distclean:	clean distclean_packages
		@chdir rc & $(MAKE) distclean
		@chdir libtai & $(MAKE) distclean
		-del ..\bin\*.exe ..\bin\*.dll ..\bin\*.pdb 2>nul
		-del ..\library\INDEX.pl 2>nul
		-del swipl.home swiplbin 2>nul

realclean:	clean
		del $(STARTUPPATH)

uninstall:
		rmdir /s /q $(PLBASE)