## Copyright (C) 1993,1994 by the author(s).
# 
# This software is published in the hope that it will be useful, but
# WITHOUT ANY WARRANTY for any part of this software to work correctly
# or as described in the manuals. See the ShapeTools Public License
# for details.
#
# Permission is granted to use, copy, modify, or distribute any part of
# this software but only under the conditions described in the ShapeTools 
# Public License. A copy of this license is supposed to have been given
# to you along with ShapeTools in a file named LICENSE. Among other
# things, this copyright notice and the Public License must be
# preserved on all copies.

#
# Makefile for st_Patches
#
# Authors: Andreas Lampen (Andreas.Lampen@cs.tu-berlin.de)
#          Axel Mahler (Axel.Mahler@cs.tu-berlin.de)
#
# $Header: Makefile[4.2] Wed Jun  8 15:35:38 1994 axel@cs.tu-berlin.de frozen $
#

# --------------------------------------------------------------------
#		locations and general macros
# --------------------------------------------------------------------

# The base directory of the project's source repository area.

BASE = /home/stone/shape/development

# Path to this node system relative to the root of the source
# repository defined above (e.g. vc/save).

NODEPATH = src/patches

# A short name for this node system

NODENAME = st_Patches

# The release number generator. The version number of this file will
# be used as release identifier for the whole system.

VERSIONFILE = Release		# source
VERSIONOBJECT =			# derived (if source contains program code)

# The operating system, $(TARGET) shall be built for.

HOSTSYSTEM = s_sunos_4

# The processor type.

HOSTTYPE = sun4

# Preprocessor switches. (eg. -DDEBUG)

SWITCHES = 

# Locations and modes for the installation of executables, header
# files, libraries and manuals.

INSTALLBASE = $(BASE)
INSTALLBINPATH = $(INSTALLBASE)/bin
INSTALLBINMODE = 755
INSTALLINCPATH = $(INSTALLBASE)/include
INSTALLINCMODE = 444
INSTALLLIBPATH = $(INSTALLBASE)/lib/shape
INSTALLLIBMODE = 644
INSTALLMANPATH = $(INSTALLBASE)/man
INSTALLMANMODE = 444

# Directories, where local libraries and header files are to be
# installed for project wide use.

LOCALLIBPATH     = $(BASE)/lib
LOCALINCLUDEPATH = $(BASE)/include

# The regular source files.

SOURCES = vgdb-patch README.vgdb vgrep-patch vgrep-Makefile-patch \
	README.vgrep vetags-patch README.vetags

# All source components of the system (should not be changed)

COMPONENTS = $(SOURCES) $(HEADERS) $(MANUALS) Shapefile Makefile Dependencies


# --------------------------------------------------------------------
#		tools, flags, libraries etc.
# --------------------------------------------------------------------

MAKE = make
SHELL = /bin/sh

INCLUDES = -I$(LOCALINCLUDEPATH)
MAKECFLAGS = -g
MAKELDFLAGS = -g

CC = cc
CFLAGS  = $(INCLUDES) $(MAKECFLAGS) $(SWITCHES)
LDFLAGS = $(MAKELDFLAGS)

RANLIB  = /usr/bin/ranlib

# System libraries, local libraries and lint libraries.

SYSLIBS   =
LOCALLIBS = $(LOCALLIBPATH)/libAtFStk.a $(LOCALLIBPATH)/libsttk.a $(LOCALLIBPATH)/libAtFS.a
LINTLIBS  =

# The following instructions are only used for vetags (see README's for
# details)

TARGET = vetags
OBJECTS = vetags.o

$(TARGET): $(LOCALLIBS) $(OBJECTS)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJECTS) $(LOCALLIBS) $(SYSLIBS)
	@_aliases="$(ALIASES)"; \
	for i in $$_aliases; \
	do \
	  rm -f $$i; \
	  echo linking $(TARGET) to $$i; \
	  ln $(TARGET) $$i; \
	done

installtargets: $(INSTALLBINPATH)/$(TARGET)

$(INSTALLBINPATH)/$(TARGET): $(TARGET)
	@-echo "installing $(TARGET) in $(INSTALLBINPATH)"; \
	if [ -f $(INSTALLBINPATH)/$(TARGET) ] && \
	   [ ! -w $(INSTALLBINPATH)/$(TARGET) ]; \
	then \
	  chmod u+w $(INSTALLBINPATH)/$(TARGET); \
	fi; \
	cp $(TARGET) $(INSTALLBINPATH)/$(TARGET); \
	chmod $(INSTALLBINMODE) $(INSTALLBINPATH)/$(TARGET); \
	_aliases="$(ALIASES)"; \
	for i in $$_aliases; \
	do \
	  rm -f $(INSTALLBINPATH)/$$i; \
	  echo "linking $(INSTALLBINPATH)/$(TARGET) to $(INSTALLBINPATH)/$$i"; \
	  ln $(INSTALLBINPATH)/$(TARGET) $(INSTALLBINPATH)/$$i; \
	done

vetags.c: etags.c
	-if patch < vetags-patch; \
	then \
	  mv etags.c vetags.c; \
	  mv etags.c.orig etags; \
        else \
          echo patching etags failed; \
	  exit 1; \
	fi

	