# This is the developer's makefile, not the user's makefile.
# Don't use it unless you know exactly what you do!


# Some important programs:
SHELL = /bin/sh
MAKE = make
COMMENT5 = comment5

# Choose one of the packers:

# Standard Unix packer. Compress afterwards.
#PACK = tar
#PACKOPT = -cvf
#PACKEXT = .tar

# GNU tar together with compress.
#PACK = tar
#PACKOPT = cvfhz
#PACKEXT = .tar.Z

# GNU tar together with GNU gzip. Excellent performance.
PACK = tar
PACKOPT = cvfhz
PACKEXT = .tar.gz

# Popular Amiga packer. Good performance.
#PACK = lha
#PACKOPT = a
#PACKEXT = .lzh

# Popular DOS packer.
#PACK = zip
#PACKOPT = -r
#PACKEXT = .zip

# Popular Atari packer.
#PACK = zoo
#PACKOPT = -add
#PACKEXT = .zoo

# The distribution's top directory is called TOPDIR here.
# Use clisp-YYYY-MM-DD where DD.MM.YYYY is the date.
TOPDIR = clisp
T = $(TOPDIR)

SOURCES1 = $T/ANNOUNCE $T/COPYRIGHT $T/GNU-GPL $T/INSTALL $T/SUMMARY $T/configure #$T/HTML-index.html
#SOURCES2 = $T/src/*
# exclude $T/src/g*t $T/src/*ne = $T/src/gettext $T/src/oldoldreadline $T/src/oldreadline $T/src/readline
SOURCES2 = $T/src/*[^et] $T/src/[^g]*t $T/src/*[^n]e $T/src/.??*
# exclude $T/src/gettext/*o/*p = $T/src/gettext/po/tmp
SOURCES3 = $T/src/gettext/*[^o] $T/src/gettext/po/*[^p]
#SOURCES4 = $T/modules/*
# exclude $T/modules/[cqrw]* = $T/modules/queens $T/modules/wildcard $T/modules/regexp $T/modules/clx
SOURCES4 = $T/modules/[^cqrw]*
SOURCES5 = $T/ffcall $T/utils $T/unix $T/dos $T/dosdjgpp $T/doswatcom $T/os2 $T/cygwin32 $T/win32gcc $T/win32msvc $T/win32bc $T/amiga $T/acorn $T/nextapp
SOURCES6 = $T/tests $T/emacs $T/doc/*.txt $T/Makefile.devel

SOURCES = $(SOURCES1) $(SOURCES2) $(SOURCES3) $(SOURCES4) $(SOURCES5) $(SOURCES6)

DOSDIR = /c:/clisp/src
EMXDIR = /c:/emx
RSXDIR = /c:/rsx
TEMPDIR = /tmp/clispdos


all : makefiles configures potfiles src/FILES src/version.h utils/comment5.c src/intparam.c src/asmi386.h src/ari80386.msvc.c src/sp80386.msvc.c ffcall/avcall/avcall.h.msvc ffcall/avcall/avcall-i386-msvc.c ffcall/vacall/config.h.msvc ffcall/vacall/vacall.h.msvc ffcall/vacall/vacall-i386-msvc.c ffcall/trampoline/config.h.msvc ffcall/callback/vacall_r/config.h.msvc ffcall/callback/vacall_r/vacall_r.h.msvc ffcall/callback/vacall_r/vacall-i386-msvc.c acorn/pathname.txt

makefiles : dos/makefile dosdjgpp/makefile doswatcom/makefile os2/makefile win32gcc/makefile win32msvc/makefile.msvc4 win32msvc/makefile.msvc5 win32bc/makefile acorn/makefile.cc acorn/makefile.gcc src/oldoldreadline/Makefile.dos src/oldoldreadline/Makefile.os2 src/oldoldreadline/Makefile.go32 src/oldreadline/Makefile.dos src/oldreadline/Makefile.os2 src/oldreadline/Makefile.go32

dos/makefile : makemake
	./makemake dos gcc > dos/makefile

dosdjgpp/makefile : makemake
	./makemake dosdjgpp gcc > dosdjgpp/makefile

doswatcom/makefile : makemake
	./makemake doswatcom wcl386 > doswatcom/makefile

os2/makefile : makemake
	./makemake os2 gcc > os2/makefile

win32gcc/makefile : makemake
	./makemake win32gcc gcc > win32gcc/makefile

win32msvc/makefile.msvc4 : makemake
	./makemake --with-dynamic-ffi win32msvc msvc4 > win32msvc/makefile.msvc4

win32msvc/makefile.msvc5 : makemake
	./makemake --with-dynamic-ffi win32msvc msvc5 > win32msvc/makefile.msvc5

win32bc/makefile : makemake
	./makemake win32bc bcc32i > win32bc/makefile

acorn/makefile.cc : makemake src/VERSION
	./makemake acorn ansi | acorn/swap-ext.pl > acorn/makefile.cc

acorn/makefile.gcc : makemake src/VERSION
	./makemake acorn gcc | acorn/swap-ext.pl > acorn/makefile.gcc

makemake : src/makemake.in
	(echo "#!/bin/sh" ; cat src/makemake.in) > makemake
	chmod a+x makemake

src/oldoldreadline/Makefile.dos : src/oldoldreadline/Makefile.in
	sed -e 's/@srcdir@/./' -e 's/@CC@/gcc/' -e 's/@ALLOCA@//' -e 's/@RANLIB@/ar s/' -e 's/@LIBS@//' -e 's/@LIBTERMCAP@/-ltermcap/' -e 's/^RM =.*$$/RM = del/' -e 's/^CP =.*$$/CP = copy/' -e 's/config.h//' -e 's/\(^	.*\)\$$(OBJECTS)/\1@objects/' < src/oldoldreadline/Makefile.in > src/oldoldreadline/Makefile.dos

src/oldoldreadline/Makefile.os2 : src/oldoldreadline/Makefile.in
	sed -e 's/@srcdir@/./' -e 's/@CC@/gcc/' -e 's/@ALLOCA@//' -e 's/@RANLIB@/ar s/' -e 's/@LIBS@//' -e 's/@LIBTERMCAP@/-ltermcap/' -e 's/^RM =.*$$/RM = del/' -e 's/^CP =.*$$/CP = copy/' -e 's/config.h//' < src/oldoldreadline/Makefile.in > src/oldoldreadline/Makefile.os2

src/oldoldreadline/Makefile.go32 : src/oldoldreadline/Makefile.in
	sed -e 's/@srcdir@/./' -e 's/@CC@/gcc/' -e 's/@ALLOCA@//' -e 's/@RANLIB@/ranlib/' -e 's/@LIBS@//' -e 's/@LIBTERMCAP@/-ltermcap/' -e 's/^RM =.*$$/RM = del/' -e 's/^CP =.*$$/CP = copy/' -e 's/config.h//' -e 's/\(^	.*\)\$$(OBJECTS)/\1@objects/' < src/oldoldreadline/Makefile.in > src/oldoldreadline/Makefile.go32

src/oldreadline/Makefile.dos : src/oldreadline/Makefile.in
	sed -e 's/@srcdir@/./' -e 's/@CC@/gcc/' -e 's/@CFLAGS@/-g -O/' -e 's/@LDFLAGS@//' -e 's/@DEFS@/-DHAVE_CONFIG_H/' -e 's/@ALLOCA@//' -e 's/@RANLIB@/ar s/' -e 's/@LIBS@//' -e 's/@LIBTERMCAP@/-ltermcap/' -e 's/^RM =.*$$/RM = del/' -e 's/^CP =.*$$/CP = copy/' -e 's/^MV =.*$$/MV = ren/' -e 's/ config.h//' -e 's/\(^	.*\)\$$(OBJECTS)/\1@objects/' < src/oldreadline/Makefile.in > src/oldreadline/Makefile.dos

src/oldreadline/Makefile.os2 : src/oldreadline/Makefile.in
	sed -e 's/@srcdir@/./' -e 's/@CC@/gcc/' -e 's/@CFLAGS@/-g -O/' -e 's/@LDFLAGS@//' -e 's/@DEFS@/-DHAVE_CONFIG_H/' -e 's/@ALLOCA@//' -e 's/@RANLIB@/ar s/' -e 's/@LIBS@//' -e 's/@LIBTERMCAP@/-ltermcap/' -e 's/^RM =.*$$/RM = del/' -e 's/^CP =.*$$/CP = copy/' -e 's/^MV =.*$$/MV = ren/' -e 's/ config.h//' < src/oldreadline/Makefile.in > src/oldreadline/Makefile.os2

src/oldreadline/Makefile.go32 : src/oldreadline/Makefile.in
	sed -e 's/@srcdir@/./' -e 's/@CC@/gcc/' -e 's/@CFLAGS@/-g -O/' -e 's/@LDFLAGS@//' -e 's/@DEFS@/-DHAVE_CONFIG_H/' -e 's/@ALLOCA@//' -e 's/@RANLIB@/ranlib/' -e 's/@LIBS@//' -e 's/@LIBTERMCAP@/-ltermcap/' -e 's/^RM =.*$$/RM = del/' -e 's/^CP =.*$$/CP = copy/' -e 's/^MV =.*$$/MV = ren/' -e 's/ config.h//' -e 's/\(^	.*\)\$$(OBJECTS)/\1@objects/' < src/oldreadline/Makefile.in > src/oldreadline/Makefile.go32


CONFIGURES = src/configure src/oldoldreadline/configure src/oldreadline/configure src/gettext/configure modules/wildcard/configure modules/regexp/configure modules/clx/new-clx/configure ffcall/configure ffcall/avcall/configure ffcall/vacall/configure ffcall/trampoline/configure ffcall/callback/configure ffcall/callback/vacall_r/configure ffcall/callback/trampoline_r/configure libiconv/configure sigsegv/configure utils/hln/configure

configures : ffcall/autoconf/aclocal.m4 sigsegv/autoconf/aclocal.m4 $(CONFIGURES) src/gettext/config.h.in

AUTOCONF_FILES = src/autoconf/aclocal.m4 src/autoconf/acgeneral.m4 src/autoconf/acspecific.m4

src/configure : src/configure.in $(AUTOCONF_FILES)
	cd src ; autoconf/autoconf -m autoconf

src/oldoldreadline/configure : src/oldoldreadline/configure.in $(AUTOCONF_FILES)
	cd src/oldoldreadline ; ../autoconf/autoconf -m ../autoconf

src/oldreadline/configure : src/oldreadline/configure.in $(AUTOCONF_FILES)
	cd src/oldreadline ; ../autoconf/autoconf -m ../autoconf

src/gettext/configure : src/gettext/configure.in src/gettext/aclocal.m4
	cd src/gettext ; $(MAKE) -f Makefile.devel configure

src/gettext/config.h.in : src/gettext/configure.in src/gettext/aclocal.m4 src/gettext/acconfig.h
	cd src/gettext ; $(MAKE) -f Makefile.devel config.h.in

modules/wildcard/configure : modules/wildcard/configure.in $(AUTOCONF_FILES)
	cd modules/wildcard ; ../../src/autoconf/autoconf -m ../../src/autoconf

modules/regexp/configure : modules/regexp/configure.in $(AUTOCONF_FILES)
	cd modules/regexp ; ../../src/autoconf/autoconf -m ../../src/autoconf

modules/clx/new-clx/configure : modules/clx/new-clx/configure.in $(AUTOCONF_FILES)
	cd modules/clx/new-clx ; ../../../src/autoconf/autoconf -m ../../../src/autoconf

ffcall/autoconf/aclocal.m4 : src/autoconf/aclocal.m4
	cd ffcall ; $(MAKE) -f Makefile.devel autoconf/aclocal.m4

ffcall/configure : ffcall/configure.in ffcall/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd ffcall ; $(MAKE) -f Makefile.devel configure

ffcall/avcall/configure : ffcall/avcall/configure.in ffcall/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd ffcall ; $(MAKE) -f Makefile.devel avcall/configure

ffcall/vacall/configure : ffcall/vacall/configure.in ffcall/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd ffcall ; $(MAKE) -f Makefile.devel vacall/configure

ffcall/trampoline/configure : ffcall/trampoline/configure.in ffcall/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd ffcall ; $(MAKE) -f Makefile.devel trampoline/configure

ffcall/callback/configure : ffcall/callback/configure.in ffcall/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd ffcall ; $(MAKE) -f Makefile.devel callback/configure

ffcall/callback/vacall_r/configure : ffcall/callback/vacall_r/configure.in ffcall/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd ffcall ; $(MAKE) -f Makefile.devel callback/vacall_r/configure

ffcall/callback/trampoline_r/configure : ffcall/callback/trampoline_r/configure.in ffcall/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd ffcall ; $(MAKE) -f Makefile.devel callback/trampoline_r/configure

libiconv/autoconf/aclocal.m4 : src/autoconf/aclocal.m4
	cd libiconv ; $(MAKE) -f Makefile.devel autoconf/aclocal.m4

libiconv/configure : libiconv/configure.in libiconv/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd libiconv ; $(MAKE) -f Makefile.devel configure

sigsegv/autoconf/aclocal.m4 : src/autoconf/aclocal.m4
	cd sigsegv ; $(MAKE) -f Makefile.devel autoconf/aclocal.m4

sigsegv/configure : sigsegv/configure.in sigsegv/autoconf/aclocal.m4 $(AUTOCONF_FILES)
	cd sigsegv ; $(MAKE) -f Makefile.devel configure

utils/hln/configure : utils/hln/configure.in $(AUTOCONF_FILES)
	cd utils/hln ; ../../src/autoconf/autoconf -m ../../src/autoconf


# Syntaxcheck
check-configures : $(CONFIGURES)
	set -e; for f in $(CONFIGURES); do bash -x -n $$f; done


potfiles :
	cd src/gettext/po ; $(MAKE) -f Makefile.devel


view-man :
	grep -v '^#[ie]' src/_clisp.1 | groff -Tascii -mandoc | less

view-html :
	grep -v '^#[ie]' src/_clisp.html > /tmp/clisp.html
	netscape /tmp/clisp.html &
	lynx /tmp/clisp.html


src/FILES : src/FILES.1
	groff -Tascii -mandoc src/FILES.1 > src/FILES

src/version.h : src/VERSION
	(echo '/* Generated automatically from src/VERSION. */' ; sed -e 's/^/#define VERSION "/' -e 's/$$/"/' src/VERSION ; sed -e 's/^\(.*\)-\(.*\)-\(.*\)$$/#define VERSION_YYYY \1/' src/VERSION ; sed -e 's/^\(.*\)-\(.*\)-\(.*\)$$/#define VERSION_YYYY_STRING "\1"/' src/VERSION ; sed -e 's/^\(.*\)-0*\(.*\)-0*\(.*\)$$/#define VERSION_MM \2/' src/VERSION ; sed -e 's/^\(.*\)-0*\(.*\)-0*\(.*\)$$/#define VERSION_DD \3/' src/VERSION) > src/version.h

utils/comment5.c : utils/comment5.d
	cd utils && $(COMMENT5) comment5

src/intparam.c : src/intparam.d
	cd src && $(COMMENT5) intparam

src/asmi386.h : src/asmi386.hh
	sed -e 's,//.*$$,,' < src/asmi386.hh > src/asmi386.h

src/ari80386.msvc.c : src/ari80386.d src/asmi386.sh
	src/asmi386.sh -no-C < src/ari80386.d > src/ari80386.msvc.c

src/sp80386.msvc.c : src/sp80386.d src/asmi386.sh
	src/asmi386.sh -no-C < src/sp80386.d > src/sp80386.msvc.c

ffcall/avcall/avcall.h.msvc : ffcall/avcall/avcall.h.in
	cd ffcall ; $(MAKE) -f Makefile.devel avcall/avcall.h.msvc

ffcall/avcall/avcall-i386-msvc.c : ffcall/avcall/avcall-i386.S ffcall/avcall/asmi386.sh
	cd ffcall ; $(MAKE) -f Makefile.devel avcall/avcall-i386-msvc.c

ffcall/vacall/config.h.msvc : ffcall/vacall/config.h.in
	cd ffcall ; $(MAKE) -f Makefile.devel vacall/config.h.msvc

ffcall/vacall/vacall.h.msvc : ffcall/vacall/vacall.h.in
	cd ffcall ; $(MAKE) -f Makefile.devel vacall/vacall.h.msvc

ffcall/vacall/vacall-i386-msvc.c : ffcall/vacall/vacall-i386.S ffcall/vacall/asmi386.sh
	cd ffcall ; $(MAKE) -f Makefile.devel vacall/vacall-i386-msvc.c

ffcall/trampoline/config.h.msvc : ffcall/trampoline/config.h.in
	cd ffcall ; $(MAKE) -f Makefile.devel trampoline/config.h.msvc

ffcall/callback/vacall_r/config.h.msvc : ffcall/callback/vacall_r/config.h.in
	cd ffcall ; $(MAKE) -f Makefile.devel callback/vacall_r/config.h.msvc

ffcall/callback/vacall_r/vacall_r.h.msvc : ffcall/callback/vacall_r/vacall_r.h.in
	cd ffcall ; $(MAKE) -f Makefile.devel callback/vacall_r/vacall_r.h.msvc

ffcall/callback/vacall_r/vacall-i386-msvc.c : ffcall/callback/vacall_r/vacall-i386.S ffcall/callback/vacall_r/asmi386.sh
	cd ffcall ; $(MAKE) -f Makefile.devel callback/vacall_r/vacall-i386-msvc.c

acorn/pathname.txt : src/pathname.d
	cat src/pathname.d | sed -e '1,/Burwood/d' | sed -e '/Komponenten/,$$d' | sed -e 's/^# //g' -e 's/^#$$//g' > acorn/pathname.txt


distrib : linux-distrib dos-distrib src-distrib

# Before doing a "make src-distrib", don't forget
# * update src/VERSION,
# * update src/CHANGES.LOG and src/NEWS,
# * "make",
# * "make check-configures",
# * check that src/genclisph.d is up to date.

src-distrib : src/FILES src/version.h potfiles force
	$(MAKE) src--distrib TOPDIR=clisp-`cat src/VERSION`

src--distrib : force
	ln -s . $(TOPDIR)
	$(PACK) $(PACKOPT) /tmp/clispsrc$(PACKEXT) $(SOURCES)
	$(PACK) $(PACKOPT) /tmp/clispsrc-oldoldreadline$(PACKEXT) $T/src/oldoldreadline
	$(PACK) $(PACKOPT) /tmp/clispsrc-oldreadline$(PACKEXT) $T/src/oldreadline
	$(PACK) $(PACKOPT) /tmp/clispsrc-readline$(PACKEXT) $T/src/readline
	$(PACK) $(PACKOPT) /tmp/clispsrc-queens$(PACKEXT) $T/modules/queens
	$(PACK) $(PACKOPT) /tmp/clispsrc-wildcard$(PACKEXT) $T/modules/wildcard
	$(PACK) $(PACKOPT) /tmp/clispsrc-regexp$(PACKEXT) $T/modules/regexp
	$(PACK) $(PACKOPT) /tmp/clispsrc-clx$(PACKEXT) $T/modules/clx
	rm -f $(TOPDIR)
# No need for this. François Pinard doesn't like CLISP's submissions any more.
# Doesn't matter; the KDE project's translations work independently too.
#	cd src/gettext/po && $(PACK) $(PACKOPT) /tmp/$(TOPDIR)-potfiles$(PACKEXT) *.po*

linux-distrib : force
	$(MAKE) linux--distrib

linux--distrib : force
	cd make.gcc && $(MAKE) PACK="$(PACK)" PACKOPT="$(PACKOPT)" PACKEXT="$(PACKEXT)" distrib

dos-distrib : force
	$(MAKE) dos--distrib PACK="zip" PACKOPT="-r" PACKEXT=".zip"

dos--distrib : force
	mkdir $(TEMPDIR)
	cp -p $(DOSDIR)/ANNOUNCE $(DOSDIR)/COPYRIGHT $(DOSDIR)/GNU-GPL $(DOSDIR)/SUMMARY $(DOSDIR)/NEWS $(TEMPDIR)
	cp -p $(DOSDIR)/lisp.exe $(TEMPDIR)
	cp -p $(DOSDIR)/lisp_1mb.exe $(TEMPDIR)
	cp -p $(DOSDIR)/lispinit.mem $(TEMPDIR)
	cp -p $(DOSDIR)/*.lsp $(TEMPDIR)
	# cp -p $(DOSDIR)/*.fas $(TEMPDIR)
	mkdir $(TEMPDIR)/locale
	for lang in en de fr es; do mkdir $(TEMPDIR)/locale/$$lang; mkdir $(TEMPDIR)/locale/$$lang/LC_MESSAGES; cp -p $(DOSDIR)/locale/$$lang/LC_MESSAGES/clisp.mo $(TEMPDIR)/locale/$$lang/LC_MESSAGES/clisp.mo; done
	cp -p $(DOSDIR)/README $(DOSDIR)/README.de $(DOSDIR)/README.en $(DOSDIR)/README.es $(DOSDIR)/clisp.1 $(DOSDIR)/clisp.html $(DOSDIR)/impnotes.html $(DOSDIR)/clisp.gif $(DOSDIR)/clreadline.3 $(DOSDIR)/clreadline.html $(TEMPDIR)
	from-ibmpc $(TEMPDIR)/clisp.1 dos/clisp.1
	from-ibmpc $(TEMPDIR)/clisp.html dos/clisp.html
	from-ibmpc $(TEMPDIR)/impnotes.html dos/impnotes.html
	from-ibmpc $(TEMPDIR)/clreadline.3 dos/clreadline.3
	from-ibmpc $(TEMPDIR)/clreadline.html dos/clreadline.html
	cd dos ; groff -Tascii -mandoc clisp.1 > clisp.man
	cd dos ; groff -Tdvi -mandoc clisp.1 > clisp.dvi
	cd dos ; groff -Tascii -mandoc clreadline.3 > clreadline.man
	cd dos ; groff -Tdvi -mandoc clreadline.3 > clreadline.dvi
	to-ibmpc dos/clisp.man $(TEMPDIR)/clisp.man
	cp -p dos/clisp.dvi $(TEMPDIR)/clisp.dvi
	to-ibmpc dos/clreadline.man $(TEMPDIR)/clreadline.man
	cp -p dos/clreadline.dvi $(TEMPDIR)/clreadline.dvi
	cd doc ; for f in CLOS-guide.txt LISP-tutorial.txt editors.txt; do to-ibmpc $$f $(TEMPDIR)/$$f; done
	cd src/readline/doc ; $(MAKE) rluserman.dvi
	cp -p src/readline/doc/rluserman.dvi $(TEMPDIR)/readline.dvi
	cp -p $(EMXDIR)/bin/emx.exe $(TEMPDIR)/emx.exe
	to-ibmpc dos/emx-faq.doc $(TEMPDIR)/emx-faq.doc
	cp -p $(EMXDIR)/doc/emxrt.doc $(TEMPDIR)/emx-user.doc
	cp -p $(EMXDIR)/etc/termcap.dat $(TEMPDIR)
	cp -p $(RSXDIR)/bin/rsx.exe $(TEMPDIR)/rsx.exe
#	cp -p $(RSXDIR)/bin/csx.exe $(TEMPDIR)/csx.exe
	cp -p $(RSXDIR)/doc/readme.txt $(TEMPDIR)/rsx-read.txt
	cp -p $(RSXDIR)/doc/rsx.hlp $(TEMPDIR)/rsx.hlp
	cp -p dos/delay.exe $(TEMPDIR)/delay.exe
	cd $(TEMPDIR) ; $(PACK) $(PACKOPT) /tmp/clisp$(PACKEXT) *
	rm -rf $(TEMPDIR)

os2-distrib : force
	$(MAKE) os2--distrib PACK="zip" PACKOPT="-r" PACKEXT=".zip"

os2--distrib : force
	mkdir $(TEMPDIR)
	cp -p $(DOSDIR)/ANNOUNCE $(DOSDIR)/COPYRIGHT $(DOSDIR)/GNU-GPL $(DOSDIR)/SUMMARY $(DOSDIR)/NEWS $(TEMPDIR)
	cp -p $(DOSDIR)/lisp.exe $(TEMPDIR)
	cp -p $(DOSDIR)/lispinit.mem $(TEMPDIR)
	cp -p $(DOSDIR)/*.lsp $(TEMPDIR)
	# cp -p $(DOSDIR)/*.fas $(TEMPDIR)
	mkdir $(TEMPDIR)/locale
	for lang in en de fr es; do mkdir $(TEMPDIR)/locale/$$lang; mkdir $(TEMPDIR)/locale/$$lang/LC_MESSAGES; cp -p $(DOSDIR)/locale/$$lang/LC_MESSAGES/clisp.mo $(TEMPDIR)/locale/$$lang/LC_MESSAGES/clisp.mo; done
	cp -p $(DOSDIR)/README $(DOSDIR)/README.de $(DOSDIR)/README.en $(DOSDIR)/README.es $(DOSDIR)/clisp.1 $(DOSDIR)/clisp.html $(DOSDIR)/impnotes.html $(DOSDIR)/clisp.gif $(DOSDIR)/clreadline.3 $(DOSDIR)/clreadline.html $(TEMPDIR)
	from-ibmpc $(TEMPDIR)/clisp.1 os2/clisp.1
	from-ibmpc $(TEMPDIR)/clisp.html os2/clisp.html
	from-ibmpc $(TEMPDIR)/impnotes.html os2/impnotes.html
	from-ibmpc $(TEMPDIR)/clreadline.3 os2/clreadline.3
	from-ibmpc $(TEMPDIR)/clreadline.html os2/clreadline.html
	cd os2 ; groff -Tascii -mandoc clisp.1 > clisp.man
	cd os2 ; groff -Tdvi -mandoc clisp.1 > clisp.dvi
	cd os2 ; groff -Tascii -mandoc clreadline.3 > clreadline.man
	cd os2 ; groff -Tdvi -mandoc clreadline.3 > clreadline.dvi
	to-ibmpc os2/clisp.man $(TEMPDIR)/clisp.man
	cp -p os2/clisp.dvi $(TEMPDIR)/clisp.dvi
	to-ibmpc os2/clreadline.man $(TEMPDIR)/clreadline.man
	cp -p os2/clreadline.dvi $(TEMPDIR)/clreadline.dvi
	cd doc ; for f in CLOS-guide.txt LISP-tutorial.txt editors.txt; do to-ibmpc $$f $(TEMPDIR)/$$f; done
	cd src/readline/doc ; $(MAKE) rluserman.dvi
	cp -p src/readline/doc/rluserman.dvi $(TEMPDIR)/readline.dvi
	cp -p $(EMXDIR)/bin/emx.exe $(TEMPDIR)/emx.exe
	to-ibmpc dos/emx-faq.doc $(TEMPDIR)/emx-faq.doc
	cp -p $(EMXDIR)/doc/emxrt.doc $(TEMPDIR)/emx-user.doc
	cp -p $(EMXDIR)/dll/emx.dll $(TEMPDIR)
	cp -p $(EMXDIR)/dll/emxlibc.dll $(TEMPDIR)
	cp -p $(EMXDIR)/etc/termcap.dat $(TEMPDIR)
	cd $(TEMPDIR) ; $(PACK) $(PACKOPT) /tmp/clisp$(PACKEXT) *
	rm -rf $(TEMPDIR)

update-version : force
	date +%Y-%m-%d >src/VERSION
	date "+%e %B %Y" >CHANGES.LOG
	cat src/CHANGES.LOG >>CHANGES.LOG
	mv CHANGES.LOG src
	echo "Remember to fix src/CHANGES.LOG and src/NEWS"

force :
