ifdef Debug
-d      = -d
CFLAGS  = -gstabs+3
else
CFLAGS  = -O6 -funroll-loops
endif
# Comment this to enable the setting of the Win95 titlebar strings
DOSFLAGS = -DNO_TITLES 
srcdir=.
VPATH=.
CC=gcc
CPP=gcc -E
CPPFLAGS=
LDFLAGS=-s
LN_S=cp -p
dot = .
dotdot = ${dot}${dot}
lispsource = ${srcdir}/$(dot)$(dot)/lisp/
libsrc = $(dot)$(dot)/lib-src/
etc = $(dot)$(dot)/etc/
shortnamesdir = $(dot)$(dot)/shortnames/
cppdir = $(dot)$(dot)/cpp/
oldXMenudir = $(dot)$(dot)/oldXMenu/
lwlibdir = $(dot)$(dot)/lwlib/
M_FILE = ${srcdir}/m/intel386.h
S_FILE = ${srcdir}/s/msdos.h
config_h = config.h $(M_FILE) $(S_FILE)
C_SWITCH_SYSTEM=
SHELL=/bin/sh
TOOLKIT_DEFINES =
ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAG) -I. -I${srcdir} ${CFLAGS} ${NLS}
%$(-d).o: %.c
	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< -o $@
all: emacs
ifdef UseNLS
NLSLIB=-lintl
NLS=-DUSE_NLS
NLSOBJ=egettext$(-d).o
else
NLSOBJ=notext$(-d).o
notext.c: egettext.c
	cp -f $< $@
endif
LD = $(CC)
ALL_LDFLAGS = $(LDFLAGS)
obj1= dispnew$(-d).o frame$(-d).o scroll$(-d).o xdisp$(-d).o xmenu$(-d).o window$(-d).o charset$(-d).o coding$(-d).o category$(-d).o ccl$(-d).o cm$(-d).o term$(-d).o xfaces$(-d).o $(XOBJ) emacs$(-d).o keyboard$(-d).o macros$(-d).o keymap$(-d).o sysdep$(-d).o buffer$(-d).o filelock$(-d).o insdel$(-d).o marker$(-d).o intervals$(-d).o textprop$(-d).o minibuf$(-d).o fileio$(-d).o dired$(-d).o filemode$(-d).o
obj2=cmds$(-d).o casetab$(-d).o casefiddle$(-d).o indent$(-d).o search$(-d).o regex$(-d).o undo$(-d).o alloc$(-d).o data$(-d).o doc$(-d).o editfns$(-d).o callint$(-d).o eval$(-d).o floatfns$(-d).o fns$(-d).o print$(-d).o lread$(-d).o abbrev$(-d).o syntax$(-d).o unexec$(-d).o mocklisp$(-d).o bytecode$(-d).o process$(-d).o callproc$(-d).o region-cache$(-d).o doprnt$(-d).o strftime$(-d).o getloadavg$(-d).o dosfns$(-d).o msdos$(-d).o w16select$(-d).o ${NLSOBJ}
SOME_MACHINE_OBJECTS = sunfns$(-d).o dosfns$(-d).o msdos$(-d).o intervals$(-d).o textprop$(-d).o xterm$(-d).o xfns$(-d).o xmenu$(-d).o xselect$(-d).o xrdb$(-d).o ${NLSOBJ}
obj=${obj1} ${obj2}
termcapobj = termcap$(-d).o tparam$(-d).o
mallocobj = gmalloc$(-d).o ralloc$(-d).o vm-limit$(-d).o
allocaobj =
widgetobj=
otherobj= $(termcapobj) lastfile$(-d).o $(mallocobj) $(allocaobj) $(widgetobj)
lisp1=../lisp/abbrev.elc ../lisp/buff-menu.elc ../lisp/byte-run.elc ../lisp/cus-start.el ../lisp/custom.elc ../lisp/emacs-lisp/lisp-mode.elc ../lisp/emacs-lisp/lisp.elc ../lisp/faces.elc ../lisp/files.elc ../lisp/format.elc ../lisp/help.elc ../lisp/indent.elc ../lisp/isearch.elc ../lisp/loadup.el ../lisp/loaddefs.el
lisp2=../lisp/bindings.el ../lisp/map-ynp.elc ../lisp/international/mule.elc ../lisp/international/mule-conf.el ../lisp/international/mule-cmds.elc ../lisp/international/characters.elc ../lisp/case-table.elc ../lisp/language/chinese.elc ../lisp/language/cyrillic.elc ../lisp/language/devanagari.elc
lisp3=../lisp/language/english.elc ../lisp/language/ethiopic.elc ../lisp/language/european.elc ../lisp/language/greek.elc ../lisp/language/hebrew.elc ../lisp/language/indian.elc ../lisp/language/japanese.elc ../lisp/language/korean.elc ../lisp/language/lao.elc ../lisp/language/thai.elc ../lisp/language/tibetan.elc ../lisp/language/vietnamese.elc
lisp4=../lisp/language/misc-lang.elc ../lisp/paths.el ../lisp/register.elc ../lisp/replace.elc ../lisp/simple.elc ../lisp/startup.elc ../lisp/subr.elc ../lisp/textmodes/fill.elc ../lisp/textmodes/page.elc ../lisp/textmodes/paragraphs.elc ../lisp/textmodes/text-mode.elc ../lisp/vc-hooks.elc ../lisp/ediff-hook.elc ../lisp/widget.elc ../lisp/window.elc ../lisp/version.el
shortlisp=${lisp1} ${lisp2} ${lisp3} ${lisp4}
SOME_MACHINE_LISP = ../lisp/facemenu.elc ../lisp/float-sup.elc ../lisp/frame.elc ../lisp/menu-bar.elc ../lisp/mouse.elc ../lisp/select.elc ../lisp/scroll-bar.elc ../lisp/vmsproc.elc ../lisp/vms-patch.elc ../lisp/ls-lisp.elc ../lisp/dos-fns.elc ../lisp/w32-fns.elc ../lisp/dos-w32.elc
lisp=$(subst ${lispsource}, ../, $(shortlisp) $(SOME_MACHINE_LISP))
LIBES = $(LOADLIBES) $(LDLIBS) $(LIBX) $(NLSLIB) -lg $(GNULIB_VAR) -lm $(GNULIB_VAR)
emacs: temacs ${etc}DOC ${lisp}
	go32 temacs -batch -l loadup dump
ifndef Debug
	strip $@
endif
	stubify $@
	stubedit $@.exe minstack=2m bufsize=48k argv0=Emacs
#	-./emacs -q -batch -f list-load-path-shadows
${etc}:
	mkdir $@
${etc}BaseDoc: ${etc} ${libsrc}make-docfile.exe ${obj}
	-rm -f $@
	${libsrc}make-docfile -o $@ -d ${srcdir} ${obj1}
	${libsrc}make-docfile -a $@ -d ${srcdir} ${obj2}
${etc}DOC: ${libsrc}make-docfile.exe ${etc}BaseDoc ${lisp}
	-cp -f ${etc}BaseDoc $@
	${libsrc}make-docfile -a $@ -d ${srcdir} ${SOME_MACHINE_LISP}
	${libsrc}make-docfile -a $@ -d ${srcdir} ${lisp1}
	${libsrc}make-docfile -a $@ -d ${srcdir} ${lisp2}
	${libsrc}make-docfile -a $@ -d ${srcdir} ${lisp3}
	${libsrc}make-docfile -a $@ -d ${srcdir} ${lisp4}
${libsrc}make-docfile.exe:
	cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile.exe
temacs: $(LOCALCPP) $(SHORT) $(STARTFILES) ${obj} ${otherobj}
	echo ${STARTFILES} ${obj} ${otherobj} >$@.rsp
	$(LD) ${STARTFLAGS} -o $@.exe @$@.rsp ${LIBES}
	exe2coff $@.exe
	rm -f $@.exe $@.rsp
ifndef Debug
	strip $@
endif
prefix-args.exe: prefix-args.c $(config_h)
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $< -o $@
CPP = $(CC) -E
stamp-oldxmenu:
	touch stamp-oldxmenu
../config.status:: paths.in
	@echo "The file paths.h needs to be set up from paths.in."
	@echo "Please run the `configure' script again."
	exit 1
../config.status:: config.in
	@echo "The file config.h needs to be set up from config.in."
	@echo "Please run the `configure' script again."
	exit 1
abbrev$(-d).o: abbrev.c buffer.h window.h commands.h $(config_h)
buffer$(-d).o: buffer.c buffer.h region-cache.h commands.h window.h intervals.h blockinput.h charset.h $(config_h)
callint$(-d).o: callint.c window.h commands.h buffer.h mocklisp.h keyboard.h $(config_h)
callproc$(-d).o: callproc.c paths.h buffer.h commands.h $(config_h) process.h systty.h syssignal.h charset.h coding.h
casefiddle$(-d).o: casefiddle.c syntax.h commands.h buffer.h $(config_h)
casetab$(-d).o: casetab.c buffer.h $(config_h)
category$(-d).o: category.c category.h buffer.h charset.h $(config_h)
ccl$(-d).o: ccl.c ccl.h charset.h coding.h $(config_h)
charset$(-d).o: charset.c charset.h buffer.h coding.h disptab.h $(config_h)
coding$(-d).o: coding.c coding.h buffer.h charset.h $(config_h)
cm$(-d).o: cm.c cm.h termhooks.h $(config_h)
cmds$(-d).o: cmds.c syntax.h buffer.h charset.h commands.h window.h $(config_h)
pre-crt0$(-d).o: pre-crt0.c
ecrt0$(-d).o: ${srcdir}/ecrt0.c $(config_h)
	CRT0_COMPILE $< -o $@
dired$(-d).o: dired.c commands.h buffer.h $(config_h) regex.h
dispnew$(-d).o: dispnew.c commands.h frame.h window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h disptab.h systty.h systime.h xterm.h blockinput.h charset.h $(config_h)
doc$(-d).o: doc.c $(config_h) paths.h buffer.h keyboard.h
doprnt$(-d).o: doprnt.c charset.h $(config_h)
dosfns$(-d).o: buffer.h termchar.h termhooks.h frame.h msdos.h dosfns.h $(config_h)
editfns$(-d).o: editfns.c window.h buffer.h systime.h intervals.h charset.h $(config_h)
emacs$(-d).o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h intervals.h $(config_h)
fileio$(-d).o: fileio.c window.h buffer.h systime.h intervals.h charset.h coding.h $(config_h)
filelock$(-d).o: filelock.c buffer.h paths.h $(config_h)
filemode$(-d).o: filemode.c $(config_h)
frame$(-d).o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h buffer.h charset.h fontset.h $(config_h)
fontset$(-d).o: fontset.h fontset.c ccl.h charset.h frame.h $(config_h)
getloadavg$(-d).o: getloadavg.c $(config_h)
indent$(-d).o: indent.c frame.h window.h indent.h buffer.h $(config_h) termchar.h termopts.h disptab.h region-cache.h charset.h
insdel$(-d).o: insdel.c window.h buffer.h intervals.h blockinput.h charset.h $(config_h)
keyboard$(-d).o: keyboard.c termchar.h termhooks.h termopts.h buffer.h charset.h commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h systty.h systime.h dispextern.h intervals.h blockinput.h xterm.h $(config_h)
keymap$(-d).o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h puresize.h charset.h $(config_h)
lastfile$(-d).o: lastfile.c $(config_h)
macros$(-d).o: macros.c window.h buffer.h commands.h macros.h keyboard.h $(config_h)
malloc$(-d).o: malloc.c $(config_h)
gmalloc$(-d).o: gmalloc.c $(config_h)
ralloc$(-d).o: ralloc.c $(config_h)
vm-limit$(-d).o: vm-limit.c mem-limits.h $(config_h)
marker$(-d).o: marker.c buffer.h $(config_h)
minibuf$(-d).o: minibuf.c syntax.h dispextern.h frame.h window.h buffer.h commands.h charset.h $(config_h)
mktime$(-d).o: mktime.c $(config_h)
mocklisp$(-d).o: mocklisp.c buffer.h $(config_h)
msdos$(-d).o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h termopts.h frame.h window.h $(config_h)
	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(DOSFLAGS) $< -o $@
process$(-d).o: process.c process.h buffer.h window.h termhooks.h termopts.h commands.h syssignal.h systime.h systty.h syswait.h frame.h blockinput.h charset.h coding.h $(config_h)
regex$(-d).o: regex.c syntax.h buffer.h $(config_h) regex.h category.h charset.h
region-cache$(-d).o: region-cache.c buffer.h region-cache.h
scroll$(-d).o: scroll.c termchar.h dispextern.h frame.h $(config_h)
search$(-d).o: search.c regex.h commands.h buffer.h region-cache.h syntax.h blockinput.h category.h charset.h $(config_h)
strftime$(-d).o: strftime.c $(config_h)
	$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Dstrftime=emacs_strftime $< -o $@
syntax$(-d).o: syntax.c syntax.h buffer.h commands.h category.h charset.h $(config_h)
sysdep$(-d).o: sysdep.c $(config_h) dispextern.h termhooks.h termchar.h termopts.h frame.h syssignal.h systty.h systime.h syswait.h blockinput.h window.h
term$(-d).o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h disptab.h keyboard.h charset.h coding.h
termcap$(-d).o: termcap.c $(config_h)
terminfo$(-d).o: terminfo.c $(config_h)
tparam$(-d).o: tparam.c $(config_h)
undo$(-d).o: undo.c buffer.h commands.h $(config_h)
UNEXEC_ALIAS= unexec$(-d).o
$(UNEXEC_ALIAS): unexec.c $(config_h)
w16select$(-d).o: w16select.c lisp.h dispextern.h frame.h blockinput.h
widget$(-d).o: widget.c xterm.h frame.h dispextern.h widgetprv.h $(config_h)
window$(-d).o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h termhooks.h disptab.h keyboard.h $(config_h)
xdisp$(-d).o: xdisp.c macros.h commands.h indent.h buffer.h dispextern.h coding.h termchar.h frame.h window.h disptab.h termhooks.h charset.h $(config_h)
xfaces$(-d).o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h window.h charset.h $(config_h)
xfns$(-d).o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h blockinput.h paths.h charset.h $(config_h)
xmenu$(-d).o: xmenu.c xterm.h termhooks.h window.h dispextern.h frame.h keyboard.h blockinput.h puresize.h msdos.h $(config_h)
xterm$(-d).o: xterm.c xterm.h termhooks.h termopts.h termchar.h window.h dispextern.h frame.h disptab.h blockinput.h systime.h syssignal.h keyboard.h gnu.h sink.h sinkmask.h charset.h ccl.h fontset.h $(config_h)
xselect$(-d).o: xselect.c dispextern.h frame.h xterm.h blockinput.h charset.h coding.h $(config_h)
xrdb$(-d).o: xrdb.c $(config_h) paths.h
hftctl$(-d).o: hftctl.c $(config_h)
alloc$(-d).o: alloc.c frame.h window.h buffer.h puresize.h syssignal.h keyboard.h blockinput.h $(config_h) intervals.h
bytecode$(-d).o: bytecode.c buffer.h syntax.h $(config_h)
data$(-d).o: data.c buffer.h puresize.h charset.h syssignal.h keyboard.h $(config_h)
eval$(-d).o: eval.c commands.h keyboard.h blockinput.h $(config_h)
floatfns$(-d).o: floatfns.c $(config_h)
fns$(-d).o: fns.c commands.h $(config_h) frame.h buffer.h keyboard.h frame.h window.h intervals.h
print$(-d).o: print.c process.h frame.h window.h buffer.h keyboard.h charset.h $(config_h)
lread$(-d).o: lread.c commands.h keyboard.h buffer.h paths.h charset.h $(config_h) termhooks.h
textprop$(-d).o: textprop.c buffer.h window.h intervals.h $(config_h)
intervals$(-d).o: intervals.c buffer.h intervals.h keyboard.h puresize.h $(config_h)
sunfns$(-d).o: sunfns.c buffer.h window.h $(config_h)
${libsrc}emacstool: ${libsrc}emacstool.c
	cd ${libsrc}; ${MAKE} ${MFLAGS} emacstool
mostlyclean:
	rm -f temacs prefix-args core \#* *.o libXMenu11.a liblw.a
	rm -f ../etc/DOC
clean: mostlyclean
	rm -f emacs-* emacs
distclean: clean
	rm -f paths.h config.h Makefile Makefile.c ../etc/DOC-*
maintainer-clean: distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."
	rm -f TAGS
versionclean:
	-rm -f emacs emacs-* ../etc/DOC*
extraclean: distclean
	-rm -f *~ \#* m/?*~ s/?*~
SOURCES = *.[ch] [sm]/?* COPYING Makefile.in config.in paths.in README COPYING ChangeLog vms.pp-trans
unlock:
	chmod u+w $(SOURCES)
relock:
	chmod -w $(SOURCES)
	chmod +w paths.h
ctagsfiles = [a-zA-Z]*.[hc]
lisptagsfiles = ../lisp/[a-zA-Z]*.el
TAGS: $(srcdir)/$(ctagsfiles)
	export DIR; DIR=`pwd`; cd ${srcdir}; $$DIR/../lib-src/etags --include=../lisp/TAGS --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' $(ctagsfiles)
${lispsource}TAGS: ${lispsource}$(lisptagsfiles)
	export DIR; DIR=`pwd`; cd ${lispsource}; $(MAKE) TAGS ETAGS=$$DIR/../lib-src/etags
tags: TAGS ${lispsource}TAGS
.PHONY: tags
