#
# $Id: smakefile 1.38 2000/12/14 08:43:52 olsen Exp olsen $
#
# :ts=8
#
# SMB file system wrapper for AmigaOS, using the AmiTCP V4 API
#
# Copyright (C) 2000 by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
#
# This program 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.
#
# This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#

.c.o:
	sc $(CFLAGS) $<
	@ctags >tagfiles/$* $<

.asm.o:
	asm $(ASMFLAGS) $<

###############################################################################

PROJECT = smbfs

###############################################################################

#############################################################################
#
# Program version
#
#############################################################################

VERSION = 1

###############################################################################

OPTIMIZE =	optimize opttime optinline optinlocal optschedule
CPU =		any
#CPU =		060
#DEBUG =	line
DEBUG =		symbolflush noopt

###############################################################################

ASMFLAGS =	-d
CFLAGS =	idlen=64 comnest streq strmerge nostkchk \
		$(OPTIMIZE) cpu=$(CPU) debug=$(DEBUG) \
		params=register idir=netinclude idir=include \
		gst=system_headers.gst
LFLAGS =	smallcode smalldata noicons batch

###############################################################################

C_FILES =	main.c proc.c smb_abstraction.c crypt.c

ASM_FILES =

HEADERS =	smb_abstraction.h \
		include/smb/smb.h include/smb/smbno.h include/smb/smb_fs.h \
		include/smb/smb_fs_sb.h include/smb/smb_mount.h

OTHER =		smakefile $(PROJECT)_rev.h $(PROJECT)_rev.i $(PROJECT)_rev.rev \
		system_headers.c system_headers.h \
		assert.c assert.h \
		smbfs.doc history.doc

SOURCE =	$(C_FILES) $(ASM_FILES) $(HEADERS) $(OTHER)

OBJS =		main.o proc.o smb_abstraction.o sock.o crypt.o

###############################################################################

LIBS = lib:sc.lib lib:amiga.lib lib:debug.lib

###############################################################################

all: tagfiles system_headers.gst $(PROJECT)

tagfiles:
	makedir $@

$(PROJECT): $(OBJS) system_headers.gst Assert.o
	slink $(OBJS) to $@.debug lib $(LIBS) Assert.o $(LFLAGS) \
		map $(PROJECT).map,fhx fwidth 32 pwidth 32 swidth 32
	slink $@.debug to $@ noicons nodebug
	@type tagfiles/\#? >t:tags
	@copy t:tags ""
	@delete >nil: t:tags

system_headers.gst: system_headers.h system_headers.c
	gst unload $@
	sc $(CFLAGS) nodebug noobjname nogst makegst=$@ system_headers.c

###############################################################################

clean:
	-delete \#?.o $(PROJECT)(%|.debug)

realclean: clean
	-delete system_headers.gst tags tagfiles \#?.map all

###############################################################################

mkid:
	mkid -v \#?.(c|h|a|asm|i) include/smb/\#?.h \
		netinclude/\#?/\#?.h \
		netinclude/\#?.h

update:
	mkid -v -u

version:
	bumprev $(VERSION) $(PROJECT)

###############################################################################

rcsdiff:
	rcsdiff -rV1_14 -rV1_16_STABLE $(SOURCE)

checkout:
	co -lV1_17 $(SOURCE)

checkin: rcs
	ci -M -d -l$(VERSION) -m. -t-. $(SOURCE)

freeze: rcs
	rcs -q -nV$(VERSION)_`type $(PROJECT)_rev.rev`: $(SOURCE)

unlock: rcs
	rcs -u $(SOURCE)

lock: rcs
	rcs -l $(SOURCE)

rcs:
	makedir $@

###############################################################################

xref:
	cxref -Iinclude -Inetinclude -xref -no-comments \#?.c
	cxref -Iinclude -Inetinclude -xref -no-comments -index -html \#?.c

xref-update:
	cxref -Iinclude -Inetinclude -xref -no-comments -index -html \#?.c

xref-clean:
	-delete \#?.html cxref.\#?
