#
# /emx/src/os2/makefile
#
# Copyright (c) 1992-1994 by Eberhard Mattes
#
# This file is part of emx.
#
# emx is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# emx is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with emx; see the file COPYING.  If not, write to the
# Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
# As special exception, emx.dll can be distributed without source code
# unless it has been changed.  If you modify emx.dll, this exception
# no longer applies and you must remove this paragraph from all source
# files for emx.dll.
#


.SUFFIXES: .obj .asm .c

MLOPT=
LINKOPT=
DLL=\emx\dll\ #
#DLL=\emx\test\ #
I=c:\emx\include\ #
MAP=c:\emx\etc\ #
LIB=c:\emx\lib\ #
LIBS=$(LIB)mt\c.lib $(LIB)mt\sys.lib $(LIB)os2.lib

ML=ml -c -Cp -W3 -WX -VM -nologo $(MLOPT)
CC=gcc
CFLAGS=-c -mprobe -O -Wall -Werror

.asm.obj:
	$(ML) $<

.c.obj:
	$(CC) $(CFLAGS) $<
	emxomf -ds $*.o

default:	all
all:		emx emxio
emx:		$(DLL)emx.dll
emxio:		$(DLL)emxio.dll

debug:
		@$(MAKE) $(MAKEFLAGS) /NOLOGO MLOPT=-Zi LINKOPT=/CO

$(DLL)emx.dll:	emxdll.obj doscall.obj syscall.obj init.obj memory.obj \
		process.obj select.obj signal.obj time.obj fileio.obj \
		ptrace.obj core.obj termio.obj keyboard.obj errors.obj \
		utils.obj tcpip.obj pm.obj clib1.obj wrapper.obj emxdll.def
	-emxload -qw
	link386 /nol /noi emxdll doscall syscall init memory process select \
		signal time fileio ptrace core termio keyboard errors utils \
		tcpip pm clib1 wrapper, \
		$(DLL)emx.dll, $(MAP)emx /map, $(LIBS), \
		emxdll /nod

emxdll.obj:	emxdll.asm emxdll.inc

core.obj: core.c emxdll.h $(I)sys/user.h reg.h clib.h

doscall.obj: doscall.c emxdll.h

syscall.obj: syscall.c emxdll.h tcpip.h version.h $(I)sys/timeb.h

fileio.obj: fileio.c emxdll.h files.h $(I)sys/fcntl.h $(I)sys/errno.h \
		clib.h $(I)sys/types.h $(I)sys/stat.h $(I)sys/ioctl.h \
		$(I)sys/termio.h $(I)sys/time.h $(I)sys/emx.h

init.obj: init.c emxdll.h clib.h version.h $(I)sys/emx.h

memory.obj: memory.c emxdll.h

pm.obj: pm.c emxdll.h

process.obj: process.c emxdll.h clib.h $(I)sys/signal.h $(I)sys/errno.h \
		$(I)sys/wait.h $(I)sys/emx.h $(I)sys/process.h

ptrace.obj: ptrace.c $(I)sys/signal.h $(I)sys/ptrace.h $(I)sys/user.h \
		reg.h $(I)sys/errno.h emxdll.h clib.h

select.obj: select.c emxdll.h files.h select.h tcpip.h clib.h \
		$(I)sys/termio.h $(I)sys/errno.h $(I)sys/types.h $(I)sys/emx.h

signal.obj: signal.c emxdll.h wrapper.h \
		$(I)sys/signal.h $(I)sys/errno.h $(I)sys/emx.h

tcpip.obj: tcpip.c emxdll.h files.h tcpip.h select.h clib.h $(I)sys/errno.h \
		$(I)sys/types.h $(I)sys/stat.h $(I)sys/ioctl.h $(I)sys/emx.h \
		$(I)sys/fcntl.h $(I)sys/socket.h $(I)sys/so_ioctl.h \
		$(I)net/route.h $(I)net/if.h $(I)net/if_arp.h $(I)netdb.h

termio.obj: termio.c emxdll.h files.h clib.h $(I)sys/errno.h $(I)sys/fcntl.h \
		$(I)sys/signal.h $(I)sys/ioctl.h $(I)sys/termio.h $(I)termios.h

keyboard.obj: keyboard.c emxdll.h clib.h

time.obj: time.c emxdll.h $(I)limits.h $(I)sys/timeb.h

errors.obj: errors.c emxdll.h $(I)sys/errno.h

utils.obj: utils.c emxdll.h

clib1.obj: clib1.c clib.h

wrapper.obj: wrapper.c wrapper.h $(I)os2thunk.h

$(DLL)emxio.dll: emxio.obj emxio.def
	link386 /nol emxio, $(DLL)emxio.dll, $(MAP)emxio /map,, emxio

emxio.obj: emxio.asm emxdll.inc

clean:
	-del *.obj

realclean: clean

# End of /emx/src/os2/makefile
