Skip to content
Makefile.w64 18.1 KiB
Newer Older
#
#  Makefile for MKCL
#
#  Copyright (c) 2010-2012, Jean-Claude Beaudoin.
#  Copyright by a number of previous anonymous authors
#            presumed to be the same as for the rest of MKCL.
#
#  MKCL is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 3 of the License, or (at your option) any later version.
#
#  See file '../Copyright' for full details.
#
#
top_srcdir= /usr/home/Jean-Claude/mkcl/src
srcdir	= /usr/home/Jean-Claude/mkcl/src

# Programs used by "make":
#


CC	= gcc
LIBS	= /mingw/lib/libgmp.a -lws2_32 -lm
FASL_LIBS = 
CORE_LIBS = libmkclgc.a 
LDFLAGS	=  
RM	= rm -f
LN_S	= ln -s
EXE	= .exe

# ==================== Where To Install Things ====================

# The default location for installation.  Everything is placed in
# subdirectories of this directory.  The default values for many of
# the variables below are expressed in terms of this one, so you may
# not need to change them.  This defaults to /usr/local.
prefix=/mingw
exec_prefix=${prefix}
bindir=${exec_prefix}/bin/
libdir=${exec_prefix}/lib/
includedir=${prefix}/include/
mkcldir=${exec_prefix}/lib/mkcl-1.1.1/
localmkcldir=./lib/mkcl-1.1.1/

# Programs used by "make install":
#
SHELL = /bin/sh
INSTALL	= /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_LIBRARY = $(INSTALL_SCRIPT)
INSTALL_DATA = ${INSTALL} -m 644
mkinstalldirs = $(SHELL) ./gc/mkinstalldirs

# Files

SUBDIRS = c gc
LIBRARIES = libmkclgc.a
LSP_LIBRARIES = mkcl_1.1.1.dll
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 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
TARGETS = bin/mkcl$(EXE)

MKCL_HFILES = mkcl/config.h \
              mkcl/list.h \
              mkcl/external.h \
              mkcl/internal.h \
              mkcl/mkcl-fenv.h \
              mkcl/mkcl-gc.h \
              mkcl/mkcl-inl.h \
              mkcl/mkcl-math.h \
              mkcl/number.h \
              mkcl/object.h \
              mkcl/stacks.h
#              mkcl/cs.h \

ASDF_FASLS = asdf.fasb ../contrib/asdf-bundle/mkcl.fas

CONTRIB_FASLS = \
                bytecmp.fasb \
                defsystem.fasb \
                profile.fasb \
                rt.fasb \
                serve-event.fasb \
                sockets.fasb \
                walker.fasb \
                trivial-features.fasb \
                trivial-garbage.fasb \
                alexandria.fasb \
                babel.fasb \
                cffi.fasb \
                fiveam.fasb \
                bordeaux-threads.fasb

CONTRIB_STATIC_LIBS = $(CONTRIB_FASLS:%.fasb=lib%.a)

BUILTINS = asdf profile rt serve-event sockets

MKCL_STATIC_PARTS = libmkcltop.a liblsp.a libmkclmin.a


all: bin/mkcl-config $(TARGETS) $(ASDF_FASLS) $(CONTRIB_FASLS) help.doc
.PHONY:	all

Makefile: Makefile.in config.status
	./config.status

mkcl/config.h: mkcl/config.h.in
	./config.status
	touch mkcl/config.h


bin/mkcl-small$(EXE) liblsp.a $(LSP_LIBRARIES) encodings: mkcl_min$(EXE) libmkcltop.a compile.lsp lsp/config.lsp cmp/cmpdefs.lsp lsp/*.lsp clos/*.lsp cmp/*.lsp mkcl/mkcl-cmp.h mkcl/config.h BUILD-STAMP ucd.dat
	MKCL_LIBDIR=`pwd`/ ./mkcl_min$(EXE) compile
	for i in $(LSP_LIBRARIES) ; do \
	  if test -s $$i ; then \
	    case $$i in \
	      *.dll) $(INSTALL_LIBRARY) $$i ./bin/ ;; \
	      *) ;; \
	    esac \
	  fi \
	done

ucd.dat: ../contrib/unicode/ucd.dat
	cp ../contrib/unicode/ucd.dat .


asdf.fasb libasdf.a: bin/mkcl-small$(EXE) build-asdf.lsp ../contrib/asdf/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf.lsp

bytecmp.fasb libbytecmp.a: bin/mkcl-small$(EXE) build-bytecmp.lsp ../contrib/bytecmp/bytecmp.lsp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-bytecmp.lsp

defsystem.fasb libdefsystem.a: bin/mkcl-small$(EXE) build-defsystem.lsp ../contrib/defsystem/defsystem.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-defsystem.lsp

profile.fasb libprofile.a: bin/mkcl-small$(EXE) build-profile.lsp ../contrib/profile/profile.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-profile.lsp

../contrib/sockets/package.lisp: ../contrib/sockets/sockets.lisp
	touch ../contrib/sockets/package.lisp

sockets.fasb libsockets.a: bin/mkcl-small$(EXE) build-sockets.lsp ../contrib/sockets/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-sockets.lsp

serve-event.fasb libserve-event.a: bin/mkcl-small$(EXE) build-serve-event.lsp ../contrib/serve-event/serve-event.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-serve-event.lsp

walker.fasb walker.a: bin/mkcl-small$(EXE) build-serve-event.lsp ../contrib/walker/walk.lsp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-walker.lsp


../contrib/asdf-bundle/mkcl.fas: bin/mkcl-small$(EXE) build-asdf-bundle.lsp ../contrib/asdf-bundle/*.lisp
	if [ "$${LOCALAPPDATA}" ]; then (cd "$${LOCALAPPDATA}"; rm -rf ./common-lisp/cache/mkcl-*); elif [ "$${APPDATA}" ]; then (cd "$${APPDATA}"; rm -rf ./common-lisp/cache/mkcl-*); else rm -rf $$HOME/.cache/common-lisp/mkcl-*/$$(cd ..;pwd -P)/contrib/asdf-bundle; fi
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-bundle.lsp

trivial-features.fasb libtrivial-features.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp ../contrib/trivial-features*/src/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- trivial-features ../contrib/trivial-features*/
	cp -p ../contrib/trivial-features*/trivial-features.fasb .
	cp -p ../contrib/trivial-features*/libtrivial-features.a .


trivial-garbage.fasb libtrivial-garbage.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp ../contrib/trivial-garbage*/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- trivial-garbage ../contrib/trivial-garbage*/
	cp -p ../contrib/trivial-garbage*/trivial-garbage.fasb .
	cp -p ../contrib/trivial-garbage*/libtrivial-garbage.a .


alexandria.fasb libalexandria.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp ../contrib/alexandria*/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- alexandria ../contrib/alexandria*/
	cp -p ../contrib/alexandria*/alexandria.fasb .
	cp -p ../contrib/alexandria*/libalexandria.a .

babel.fasb libbabel.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp trivial-features.fasb alexandria.fasb ../contrib/babel*/src/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- babel ../contrib/babel*/
	cp -p ../contrib/babel*/babel.fasb .
	cp -p ../contrib/babel*/libbabel.a .

cffi.fasb libcffi.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp babel.fasb ../contrib/cffi*/src/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- cffi ../contrib/cffi*/
	cp -p ../contrib/cffi*/cffi.fasb .
	cp -p ../contrib/cffi*/libcffi.a .

bordeaux-threads.fasb libbordeaux-threads.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp alexandria.fasb ../contrib/bordeaux-threads-*/src/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- bordeaux-threads ../contrib/bordeaux-threads-*/
	cp -p ../contrib/bordeaux-threads*/bordeaux-threads.fasb .
	cp -p ../contrib/bordeaux-threads*/libbordeaux-threads.a .

fiveam.fasb libfiveam.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp alexandria.fasb ../contrib/fiveam-*/src/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- fiveam ../contrib/fiveam-*/
	cp -p ../contrib/fiveam*/src/fiveam.fasb .
	cp -p ../contrib/fiveam*/src/libfiveam.a .

rt.fasb librt.a: bin/mkcl-small$(EXE) build-asdf-contrib.lsp babel.fasb ../contrib/rt*/*.lisp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-asdf-contrib.lsp -- rt ../contrib/rt*/
	cp -p ../contrib/rt*/rt.fasb .
	cp -p ../contrib/rt*/librt.a .

cmp.fasb: bin/mkcl-small$(EXE) cmp/*.lsp build-cmp.lsp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-cmp.lsp

bin/mkcl-dyn: bin/mkcl-small$(EXE) cmp.fasb build-dynamic-mkcl.lsp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-dynamic-mkcl.lsp

bin/mkcl$(EXE): bin/mkcl-small$(EXE) cmp.fasb build-mkcl.lsp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-mkcl.lsp

ifeq (mingw32,mingw32)
bin/mkcl-full$(EXE): bin/mkcl-small$(EXE) build-full-mkcl.lsp $(BUILTINS:%=lib%.a)
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-full-mkcl.lsp -- $(BUILTINS:%=lib%.a)
else
bin/mkcl-full$(EXE): bin/mkcl-small$(EXE) build-full-mkcl.lsp $(BUILTINS)
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load build-full-mkcl.lsp -- $(BUILTINS)
endif

help.doc: dump-doc.lsp bin/mkcl$(EXE) doc/help.lsp
	MKCL_LIBDIR=$$(pwd)/ bin/mkcl$(EXE) -norc -q --external-format "(:ascii :lf)" -load dump-doc.lsp

#encodings: bin/mkcl-small$(EXE) generate-encodings.lsp
#	MKCL_LIBDIR=$$(pwd)/ bin/mkcl-small$(EXE) -norc -q --external-format "(:ascii :lf)" -load generate-encodings.lsp


mkcl_min$(EXE): $(LIBRARIES) libmkclgc.a libmkclmin.a c/cinit.o c/all_symbols.o .gdbinit
	$(CC) $(LDFLAGS) -o $@ c/cinit.o c/all_symbols.o libmkclmin.a $(LIBRARIES) $(FASL_LIBS) $(LIBS)


.gdbinit: util/gdbinit
	cp util/gdbinit $@

c/cinit.o:
	cd c; $(MAKE) depend; $(MAKE) cinit.o

c/all_symbols.o:
	cd c; $(MAKE) depend; $(MAKE) all_symbols.o

lsp/config.lsp: lsp/config.pre
	sed -e 's,@mkcldir\\@,$(mkcldir),g' < lsp/config.pre > lsp/config.lsp

lsp/config.pre: lsp/config.lsp.in
	./config.status

cmp/cmpdefs.lsp: cmp/cmpdefs.pre
	sed -e 's,@mkcldir\\@,"$(mkcldir)",g' \
	    -e 's,@libdir\\@,"$(libdir)",g' \
	    -e 's,@includedir\\@,"$(includedir)",g' < cmp/cmpdefs.pre > $@

cmp/cmpdefs.pre: cmp/cmpdefs.lsp.in
	./config.status

compile.lsp: compile.pre bare.lsp lsp/load.lsp clos/load.lsp cmp/load.lsp
	sed -e 's,@mkcldir\\@,$(mkcldir),g' \
	    -e 's,@libdir\\@,$(libdir),g' < compile.pre > compile.lsp

compile.pre: compile.lsp.in
	./config.status

bare.lsp: bare.lsp.in
	./config.status

lsp/load.lsp: lsp/load.lsp.in
	./config.status

clos/load.lsp: clos/load.lsp.in
	./config.status

cmp/load.lsp: cmp/load.lsp.in
	./config.status

bin/mkcl-config: bin/mkcl-config.pre
	sed -e 's,@libdir\\@,$(libdir),' \
	    -e 's,@includedir\\@,$(includedir),' bin/mkcl-config.pre > bin/mkcl-config

bin/mkcl-config.pre: util/mkcl-config
	./config.status


libmkclmin.a: c/*.d mkcl/*.h c/arch/*.d
	cd c; $(MAKE) depend; $(MAKE)

libmkcltop.a: c/main.d c/all_symbols.d c/symbols_list.h
	cd c; $(MAKE) depend; $(MAKE)

gc/.libs/libgc.a:
	cd gc; $(MAKE)

libmkclgc.a: gc/.libs/libgc.a
	cp -p gc/.libs/libgc.a ./libmkclgc.a
	mkdir -p mkcl/gc
	cp -p gc/include/*.h mkcl/gc

# gmp/.libs/libgmp.a:
# 	cd gmp; $(MAKE)

# libmkclgmp.a: gmp/.libs/libgmp.a
# 	cp -p gmp/.libs/libgmp.a ./libmkclgmp.a
# 	cp -p gmp/gmp.h mkcl/


mkcl/mkcl-cmp.h: mkcl/mkcl.h c/symbols_list.h
	touch $@

mkcl/mkcl.h: $(MKCL_HFILES)
	touch $@

mkcl/config-install.h: mkcl/config.h
	sed '/-CUT-/,$$d' ./mkcl/config.h > ./mkcl/config-install.h


BUILD-STAMP: config.status
	echo "#" `uname -a` > $@
	head -8 config.log | tail -6 >> $@

install: install-base install-contribs
#	cd doc; $(MAKE) prefix=$(prefix) install

install-base: all mkcl/config-install.h
	$(mkinstalldirs) $(bindir) $(libdir) \
	  $(mkcldir) $(includedir) $(includedir)/mkcl
	$(INSTALL_DATA) ../Copyright ../LGPL $(mkcldir)
	$(INSTALL_DATA) ../Copyright ../LGPL $(includedir)/mkcl
	for i in $(TARGETS); do \
	  $(INSTALL_PROGRAM) $$i $(bindir); \
	done
	$(INSTALL_DATA) ucd.dat $(mkcldir)/
	if [ -d encodings ]; then \
	  $(mkinstalldirs) $(mkcldir)/encodings; \
	  for i in ./encodings/*; do \
	    $(INSTALL_DATA) $$i $(mkcldir)/encodings; \
	  done \
	fi
	$(INSTALL_DATA) ./mkcl/*.h $(includedir)/mkcl
	if (echo $(SUBDIRS) | grep gc); then \
	  $(mkinstalldirs) $(includedir)/mkcl/gc; \
	  $(INSTALL_DATA) ./mkcl/gc/*.h $(includedir)/mkcl/gc; \
	  #$(INSTALL_DATA) ./mkcl/gc/private/*.h $(includedir)/mkcl/gc/private; \
	fi
	rm $(includedir)/mkcl/config.h
	mv $(includedir)/mkcl/config-install.h $(includedir)/mkcl/config.h
	$(INSTALL_SCRIPT) bin/mkcl-config $(bindir)
	for i in BUILD-STAMP help.doc ; do \
	  $(INSTALL_DATA) $$i $(mkcldir); \
	done
	for i in $(LSP_LIBRARIES); do \
	  if test -s $$i ; then \
	    case $$i in \
	      *.dll) $(INSTALL_LIBRARY) $$i $(libdir); \
		     $(INSTALL_LIBRARY) $$i $(bindir);; \
	      *) $(INSTALL_LIBRARY) $$i $(libdir);; \
	    esac \
	  fi \
	done
	if [ "x" != "x" -a -f "" ]; then \
	  ( cd $(libdir) && rm -f    && \
	    mv   && \
	    $(LN_S)   && \
	    $(LN_S)   && \
	    $(LN_S)   ) \
	fi
	for i in $(MKCL_STATIC_PARTS) $(LIBRARIES); do \
	  if test -s $$i ; then \
	    $(INSTALL_LIBRARY) $$i $(mkcldir); \
	  fi \
	done
	$(INSTALL_DATA) c/dpp$(EXE) $(mkcldir)
	$(INSTALL_DATA) mkcl_min$(EXE) $(mkcldir)
	$(INSTALL_DATA) cmp.asd $(mkcldir)
	if [ -f libcmp.a ] ; then $(INSTALL_DATA) libcmp.a $(mkcldir); fi
	$(INSTALL_PROGRAM) cmp.fasb $(mkcldir)

install-contribs: $(ASDF_FASLS) $(CONTRIB_FASLS) # $(CONTRIB_STATIC_LIBS)
	$(mkinstalldirs) $(mkcldir)/contrib/
	for i in *.asd; do $(INSTALL_DATA) $${i} $(mkcldir)/contrib/; done
	for i in asdf.fasb $(CONTRIB_FASLS) $(CONTRIB_STATIC_LIBS); do \
	  if test -s $$i; then \
	    case $$i in \
	      *.fasb) $(INSTALL_PROGRAM) $$i $(mkcldir)/contrib/;; \
	      *) $(INSTALL_DATA) $$i $(mkcldir)/contrib/;; \
	    esac; \
	  fi \
	done
	if [ -d ../contrib/asdf-bundle ]; then \
	  (cd ../contrib/; tar cf - asdf-bundle) | (cd $(mkcldir)/contrib/; tar xof -); \
	fi
	if [ -d ../contrib/slime ]; then \
	  (cd ../contrib/; tar cf - slime) | (cd $(mkcldir)/contrib/; tar xof -); \
	fi

install-local: install-base-local install-contribs-local

install-base-local: all mkcl/config-install.h
	$(mkinstalldirs) ./lib/ \
	  $(localmkcldir) ./include/ ./include//mkcl
	$(INSTALL_DATA) ../Copyright ../LGPL $(localmkcldir)
	$(INSTALL_DATA) ../Copyright ../LGPL ./include/mkcl
	$(INSTALL_DATA) ucd.dat $(localmkcldir)/
	if [ -d encodings ]; then \
	  $(mkinstalldirs) $(localmkcldir)/encodings; \
	  for i in ./encodings/*; do \
	    $(INSTALL_DATA) $$i $(localmkcldir)/encodings; \
	  done \
	fi
	$(INSTALL_DATA) ./mkcl/*.h ./include//mkcl
	if (echo $(SUBDIRS) | grep gc); then \
	  $(mkinstalldirs) ./include//mkcl/gc; \
	  $(INSTALL_DATA) ./mkcl/gc/*.h ./include//mkcl/gc; \
	fi
	rm ./include//mkcl/config.h
	mv ./include//mkcl/config-install.h ./include//mkcl/config.h
	for i in BUILD-STAMP help.doc ; do \
	  $(INSTALL_DATA) $$i $(localmkcldir); \
	done
	for i in $(LSP_LIBRARIES); do \
	  if test -s $$i ; then \
	    case $$i in \
	      *.dll) $(INSTALL_LIBRARY) $$i ./lib/; \
		     $(INSTALL_LIBRARY) $$i ./bin/;; \
	      *) $(INSTALL_LIBRARY) $$i ./lib/;; \
	    esac \
	  fi \
	done
	if [ "x" != "x" -a -f "" ]; then \
	  ( cd ./lib/ && rm -f    && \
	    mv   && \
	    $(LN_S)   && \
	    $(LN_S)   && \
	    $(LN_S)   ) \
	fi
	for i in $(MKCL_STATIC_PARTS) $(LIBRARIES); do \
	  if test -s $$i ; then \
	    $(INSTALL_LIBRARY) $$i $(localmkcldir); \
	  fi \
	done
	$(INSTALL_DATA) c/dpp$(EXE) $(localmkcldir)
	$(INSTALL_DATA) mkcl_min$(EXE) $(localmkcldir)
	$(INSTALL_DATA) cmp.asd $(localmkcldir)
	if [ -f libcmp.a ] ; then $(INSTALL_DATA) libcmp.a $(localmkcldir); fi
	$(INSTALL_PROGRAM) cmp.fasb $(localmkcldir)

install-contribs-local: $(ASDF_FASLS) $(CONTRIB_FASLS)
	$(mkinstalldirs) $(localmkcldir)/contrib/
	for i in *.asd; do $(INSTALL_DATA) $${i} $(localmkcldir)/contrib/; done
	for i in asdf.fasb $(CONTRIB_FASLS) $(CONTRIB_STATIC_LIBS); do \
	  if test -s $$i; then \
	    case $$i in \
	      *.fasb) $(INSTALL_PROGRAM) $$i $(localmkcldir)/contrib/;; \
	      *) $(INSTALL_DATA) $$i $(localmkcldir)/contrib/;; \
	    esac; \
	  fi \
	done
	cp -pR ../contrib/asdf-bundle $(localmkcldir)/contrib/


uninstall:
	for i in $(TARGETS) mkcl-config; do $(RM) $(bindir)/$$i; done
	$(RM) -r $(includedir)/mkcl $(mkcldir)
	for i in $(LSP_LIBRARIES); do \
	  case $$i in \
	    *.dll) $(RM) $(libdir)/$$i || : ; $(RM) $(bindir)/$$i || : ;;
	    *) $(RM) $(libdir)/$$i || : ;; \
	  esac \
	done
#	cd doc; $(MAKE) uninstall

doc: $(TARGETS)
	cd doc; $(MAKE)

clean: clean_lisp clean_contribs
	cd c; $(MAKE) clean
	$(RM) compile.lsp bin/mkcl-config BUILD-STAMP mkcl/config-install.h
	$(RM) mkcl_min$(EXE) bin/mkcl$(EXE) bin/mkcl-dyn bin/mkcl-small$(EXE) bin/mkcl-full$(EXE)
	$(RM) MKCLINIT* bin/MKCLINIT*
	$(RM) MKC*.c MKC*.tmp bin/MKC*.c bin/MKC*.tmp
	$(RM) -r encodings
	$(RM) MODULES help.doc TAGS *.asd ucd.dat
	$(RM) mkcl/gc/*.h ./libmkclgc.a
	$(RM) mkcl/gmp.h ./libmkclgmp.a
	$(RM) *.dll bin/*.dll
	$(RM) *.o *.a *.la *.so *.data *.fasb *.fas core core.* a.out
	cd bin; $(RM) *.o *.a *.la *.so *.data *.fasb *.fas core core.* a.out
	$(RM) -r lib include

clean_contribs:
	$(RM) -r ext
	cd ../contrib; sh ./clean_up.sh
	$(RM) asdf.fasb $(CONTRIB_FASLS) $(CONTRIB_FASLS:%.fasb=%.asd)

clean_lisp:
	for i in lsp cmp clos; \
	do $(RM) lib$$i.a $$i/?*.{o,data,c,sdat,h,fasb,fas}; done
	$(RM) lsp/config.lsp cmp/cmpdefs.lsp
	$(RM) help.doc

distclean: clean
	cd c; $(MAKE) distclean
	$(RM) bin/mkcl-config.pre
	$(RM) Makefile bare.lsp compile.pre
	$(RM) doc/Makefile doc/mkcl.man doc/mkcl-config.man
	$(RM) mkcl/config.h mkcl/configpre.h
	$(RM) lsp/config.pre lsp/load.lsp clos/load.lsp
	$(RM) cmp/cmpdefs.pre cmp/load.lsp
	(cd gc; $(MAKE) distclean)
	$(RM) config.status config.version config.log config.cache

realclean: distclean
	cd c; $(MAKE) realclean
	$(RM) *~

TAGS: lsp/*.lsp lsp/config.pre clos/*.lsp cmp/*.lsp cmp/cmpdefs.pre c/*.d c/*.h c/arch/*.d mkcl/*.h
	if type etags >/dev/null 2>&1; then  \
	  if etags --help | grep -q -e "--language-force"; then \
	    etags -R lsp/*.lsp lsp/config.pre clos/*.lsp cmp/*.lsp cmp/cmpdefs.pre --language-force=c c/*.d c/*.h c/arch/*.d mkcl/*.h; \
	  else \
	    etags -R lsp/*.lsp lsp/config.pre clos/*.lsp cmp/*.lsp cmp/cmpdefs.pre --language=c c/*.d c/*.h c/arch/*.d mkcl/*.h; \
	  fi \
	else touch TAGS; fi



depend:
	cd c; $(MAKE) depend