#
# $Id$
#
# :ts=4
#
# AmigaOS wrapper routines for GNU CVS, using the AmiTCP V3 API
# and the SAS/C V6.58 compiler.
#
# Written and adapted by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
#                        Jens Langner <Jens.Langner@htw-dresden.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.
#

# Programs

CC  = sc
OML = oml
LNK = slink
CP  = copy
RM  = delete quiet

# ignored warnings are:
#  51 C++ comment detected                                 -- we agreed to use them
#  61 undefined struct/union tag "tag-name"                -- in include files
# 120 Integral type mismatch: possible portability problem -- should be used somewhen
# 148 use of incomplete struct/union/enum tag "name"       -- in include files
# 165 use of narrow type in prototype                      -- very unlikely portability problem
# 178 indirect call without indirection operator           -- only old-style support
# 212 item "name" already declared                         -- in include files
# 306 .. function inlined                                  -- disturbs

# Compiler/Linker flags

CPU      =  68020
DEFS     =  DEFINE=HAVE_CONFIG_H
WARN     =  WARN=ALL IGNORE=51,61,120,148,165,178,212,306
INCDIRS  =  IDIR="" IDIR="/" IDIR="/lib" IDIR="/diff" IDIR="/zlib" IDIR="/amiga/include" IDIR="/amiga" IDIR="/amiga/netinclude"
CFLAGS   =  OPT OPTTIME OPTSCHEDULE CPU=$(CPU) UTILLIB CODE=FAR COMMENTNEST STRUCTUREEQUIVALENCE \
            STRINGMERGE NOSTACKCHECK $(DEFS) $(WARN) $(INCDIRS) DEBUG=LINE
LIBS     =  /amiga/amiga.lib /amiga/ssh/ssh.lib lib:sc.lib lib:debug.lib lib:small.lib \
            src1.lib src2.lib /lib/cvs.lib /zlib/z.lib /diff/diff.lib

OBJ1     =  add.o admin.o annotate.o buffer.o checkin.o checkout.o classify.o \
            client.o commit.o create_adm.o cvsrc.o diff.o edit.o entries.o expand_path.o \
            fileattr.o find_names.o hardlink.o hash.o history.o ignore.o import.o \
            lock.o log.o login.o logmsg.o main.o mkmodules.o modules.o myndbm.o no_diff.o

OBJ2     =  parseinfo.o patch.o rcs.o rcscmds.o recurse.o release.o remove.o repos.o \
            root.o scramble.o server.o status.o tag.o update.o watch.o wrapper.o vers_ts.o \
            subr.o filesubr.o run.o version.o error.o zlib.o

OBJS     =  $(OBJ1) $(OBJ2)

HEADERS  =  buffer.h cvs.h rcs.h hardlink.h hash.h myndbm.h \
            update.h server.h client.h error.h fileattr.h edit.h watch.h

TARGET   = cvs$(CPU)

#

default: $(TARGET)

# Default rule

.c.o:
  @echo "*e[32mCompiling $*.c*e[0m"
  @$(CC) $(CFLAGS) $<

#

$(TARGET): $(OBJS) /amiga/amiga.lib /amiga/ssh/ssh.lib /lib/cvs.lib /zlib/z.lib /diff/diff.lib
  @echo "*e[32mLinking src1.lib*e[0m"
  @$(OML) src1.lib r $(OBJ1)
  @echo "*e[32mLinking src2.lib*e[0m"
  @$(OML) src2.lib r $(OBJ2)
  @echo "*e[32mLinking $@*e[0m"
  @$(LNK) lib:cres.o to $@.debug lib $(LIBS) addsym batch smalldata smallcode map $@.map,fhx \
  fwidth 32 pwidth 32 swidth 32 with lib:utillib.with addsym
  @$(LNK) $@.debug to $@ nodebug noicons
  @protect $@ +p

# leaves .lib
clean:
  -$(RM) $(OBJ1)
  -$(RM) $(OBJ2)
  -$(RM) cvs.lnk cvs.map

#
cleanall: clean
  -$(RM) $(TARGET)

#

$(OBJS): $(HEADERS) options.h

#

rcscmds.o: rcscmds.c /diff/diffrun.h
zlib.o: zlib.c /zlib/zlib.h
