# Copyright (C) 2004 Stefan Bellon <sbellon@sbellon.de>
#
# This file is part of JetDirectFS.
#
# JetDirectFS 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 of the License, or
# (at your option) any later version.
#
# JetDirectFS 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA

#DEBUG      = -DDEBUG
CC         = cc
CC_FLAGS   = -throwback -zM -zps0 -ffa -Wp -IC:,OSLib:,TCPIPLibs: $(DEBUG) -c
AS         = objasm
AS_FLAGS   = -throwback
LD         = link
LD_FLAGS   =
CMHG       = cmhg
CMHG_FLAGS = -throwback -p
DEPEND     = -depend !Depend

OBJS =  o.connection  \
	o.errors      \
	o.fsentries   \
	o.interface   \
	o.jetdirect   \
	o.module      \
	o.ro_base
	

LIBS =  TCPIPLibs:o.inetlibzm \
	TCPIPLibs:o.unixlibzm \
	TCPIPLibs:o.socklibzm \
	OSLib:o.OSLib32 \
	C:o.stubs

.INIT:
	@cdir o

.PHONY: all dist clean

## Rule Patterns ##

.SUFFIXES: .c .o .s .cmhg

.c.o:
	$(CC) $(CC_FLAGS) $(DEPEND) -c -o $@ $<

.s.o:
	$(AS) $(AS_FLAGS) $(DEPEND) $< $@

.cmhg.o:
	$(CMHG) $(CMHG_FLAGS) $(DEPEND) $< $@

# Static dependencies:

all: JetDirect

dist: jetdirect/zip jetdirectsrc/zip

clean:
	-ifthere o.* then wipe o.* ~CFR~V
	-ifthere JetDirect then wipe JetDirect ~CFR~V
	-ifthere jetdirect/zip then wipe jetdirect/zip ~CFR~V
	-ifthere jetdirectsrc/zip then wipe jetdirectsrc/zip ~CFR~V

JetDirect: $(OBJS)
	$(LD) -o JetDirect -rmf $(OBJS) $(LIBS)

jetdirect/zip: dist.JetDirect.JetDirect
	-ifthere jetdirect/zip then wipe jetdirect/zip ~CFR~V
	-copy COPYING dist.COPYING ~CFR~V
	-dir dist
	-zip -r9 ^.jetdirect/zip * -x *CVS* */cvsignore*
	-up
	-wipe dist.COPYING ~CFR~V

jetdirectsrc/zip:
	-ifthere jetdirectsrc/zip then wipe jetdirectsrc/zip ~CFR~V
	-zip -r9 jetdirectsrc/zip c ChangeLog cmhg COPYING dist h Makefile s -x *CVS* */cvsignore* dist.JetDirect.JetDirect

dist.JetDirect.JetDirect: JetDirect
	-copy JetDirect dist.JetDirect.JetDirect ~CFR~V

# Dynamic dependencies:
o.jetdirect:	cmhg.jetdirect
o.jetdirect:	h.config
o.errors:	c.errors
o.errors:	h.config
o.errors:	h.errors
o.errors:	OSLib:oslib.h.os
o.errors:	OSLib:oslib.h.types
o.errors:	OSLib:oslib.h.oscore32
o.errors:	OSLib:oslib.h.osf32
o.module:	c.module
o.module:	C:h.kernel
o.module:	OSLib:oslib.h.osfscontrol
o.module:	OSLib:oslib.h.types
o.module:	OSLib:oslib.h.os
o.module:	OSLib:oslib.h.oscore32
o.module:	OSLib:oslib.h.osf32
o.module:	OSLib:oslib.h.fileswitch
o.module:	OSLib:oslib.h.fileswch32
o.module:	OSLib:oslib.h.osfsctrl32
o.module:	h.config
o.module:	h.interface
o.module:	h.statics
o.connection:	c.connection
o.connection:	TCPIPLibs:h.unistd
o.connection:	TCPIPLibs:sys.h.cdefs
o.connection:	TCPIPLibs:sys.h.types
o.connection:	TCPIPLibs:sys.h.cdefs
o.connection:	TCPIPLibs:machine.h.endian
o.connection:	TCPIPLibs:machine.h.ansi
o.connection:	TCPIPLibs:machine.h.types
o.connection:	TCPIPLibs:sys.h.unistd
o.connection:	TCPIPLibs:sys.h._posix
o.connection:	TCPIPLibs:sys.h.types
o.connection:	TCPIPLibs:sys.h.socket
o.connection:	TCPIPLibs:sys.h.cdefs
o.connection:	TCPIPLibs:h.inetlib
o.connection:	TCPIPLibs:sys.h.types
o.connection:	TCPIPLibs:netinet.h.in
o.connection:	TCPIPLibs:h.netdb
o.connection:	TCPIPLibs:sys.h.cdefs
o.connection:	h.errors
o.connection:	OSLib:oslib.h.os
o.connection:	OSLib:oslib.h.types
o.connection:	OSLib:oslib.h.oscore32
o.connection:	OSLib:oslib.h.osf32
o.fsentries:	c.fsentries
o.fsentries:	TCPIPLibs:h.unistd
o.fsentries:	TCPIPLibs:sys.h.cdefs
o.fsentries:	TCPIPLibs:sys.h.types
o.fsentries:	TCPIPLibs:sys.h.cdefs
o.fsentries:	TCPIPLibs:machine.h.endian
o.fsentries:	TCPIPLibs:machine.h.ansi
o.fsentries:	TCPIPLibs:machine.h.types
o.fsentries:	TCPIPLibs:sys.h.unistd
o.fsentries:	TCPIPLibs:sys.h._posix
o.fsentries:	TCPIPLibs:h.socklib
o.fsentries:	TCPIPLibs:sys.h.types
o.fsentries:	TCPIPLibs:sys.h.socket
o.fsentries:	TCPIPLibs:sys.h.cdefs
o.fsentries:	TCPIPLibs:sys.h.stat
o.fsentries:	TCPIPLibs:sys.h.time
o.fsentries:	TCPIPLibs:sys.h.cdefs
o.fsentries:	TCPIPLibs:sys.h.cdefs
o.fsentries:	TCPIPLibs:sys.h.time
o.fsentries:	TCPIPLibs:sys.h.uio
o.fsentries:	TCPIPLibs:sys.h.cdefs
o.fsentries:	C:h.kernel
o.fsentries:	h.config
o.fsentries:	h.connection
o.fsentries:	h.errors
o.fsentries:	OSLib:oslib.h.os
o.fsentries:	OSLib:oslib.h.types
o.fsentries:	OSLib:oslib.h.oscore32
o.fsentries:	OSLib:oslib.h.osf32
o.fsentries:	h.statics
o.fsentries:	h.veneers
o.interface: s.interface
o.ro_base: s.ro_base
