CFLAGS= -O
CC = gcc
# For Xenix.  Needed for movemail
#  LOADLIBES= -lx
# For Iris 4d.  Needed for loadst.
#  LOADLIBES = -lmld

EXECUTABLES = test-distrib etags ctags loadst make-docfile \
   digest-doc sorted-doc movemail cvtmail fakemail yow env \
   server emacsclient

all: ${EXECUTABLES}

distclean:
	-rm -f ${EXECUTABLES} *~ \#* DOC* core

# This justs verifies that the non-ASCII characters
# in the file `testfile' have no been clobbered by
# whatever means were used to copy and distribute Emacs.
# If they were clobbered, all the .elc files were clobbered too.
test-distrib: test-distrib.c
	$(CC) -o m-test-distrib test-distrib.c
	gcc2minix < m-test-distrib > test-distrib
	chmod +x test-distrib
	./test-distrib

etags: etags.c
	$(CC) -o m-etags ${CFLAGS} -DETAGS etags.c $(LOADLIBES)
	gcc2minix <m-etags >etags
	chmod +x etags

ctags: etags.c
	$(CC) -o m-ctags ${CFLAGS} -DCTAGS etags.c $(LOADLIBES)
	gcc2minix <m-ctags > ctags
	chmod +x ctags

loadst: loadst.c ../src/config.h
	$(CC) -o m-loadst ${CFLAGS} loadst.c $(LOADLIBES)
	gcc2minix < m-loadst >loadst
	chmod +x loadst

make-docfile: make-docfile.c
	$(CC) -o m-make-docfile ${CFLAGS} make-docfile.c $(LOADLIBES)
	gcc2minix < m-make-docfile > make-docfile
	chmod +x make-docfile

digest-doc: digest-doc.c
	$(CC) -o m-digest-doc ${CFLAGS} digest-doc.c $(LOADLIBES)
	gcc2minix < m-digest-doc > digest-doc
	chmod +x digest-doc

sorted-doc: sorted-doc.c
	$(CC) -o m-sorted-doc ${CFLAGS} sorted-doc.c $(LOADLIBES)
	gcc2minix < m-sorted-doc > sorted-doc
	chmod +x sorted-doc

#
movemail: movemail.c ../src/config.h
	$(CC) -o m-movemail ${CFLAGS} movemail.c $(LOADLIBES)
	gcc2minix < m-movemail > movemail
	chmod +x movemail

cvtmail: cvtmail.c
	$(CC) -o m-cvtmail ${CFLAGS} cvtmail.c $(LOADLIBES)
	gcc2minix < m-cvtmail > cvtmail
	chmod +x cvtmail

fakemail: fakemail.c ../src/config.h
	$(CC) -o m-fakemail ${CFLAGS} fakemail.c $(LOADLIBES)
	gcc2minix < m-fakemail > fakemail
	chmod +x fakemail

yow: yow.c ../src/paths.h
	$(CC) -o m-yow ${CFLAGS} yow.c $(LOADLIBES)
	gcc2minix < m-yow > yow
	chmod +x yow

# this is silly -- just use emacs to edit this file!
# (in any case this program doesn't preserve alphabetical ordering,
#  which is why I'm removing it)
#addyow: addyow.c
#	$(CC) -o m-addyow ${CFLAGS} addyow.c

env: env.c ../src/config.h
	$(CC) -o m-env -DEMACS ${CFLAGS} env.c $(LOADLIBES)
	gcc2minix < m-env > m-env
	chmod +x env

server: server.c ../src/config.h
	$(CC) -o m-server ${CFLAGS} server.c $(LOADLIBES)
	gcc2minix < m-server > server
	chmod +x server

emacsclient: emacsclient.c ../src/config.h
	$(CC) -o m-emacsclient ${CFLAGS} emacsclient.c $(LOADLIBES)
	gcc2minix < m-emacsclient > emacsclient
	chmod +x emacsclient

# This one is NOT included in EXECUTABLES.
# See ../src/ymakefile.
emacstool: emacstool.c
	$(CC) emacstool.c -o m-emacstool -g -lsuntool -lsunwindow -lpixrect $(LOADLIBES)
