# # Copyright (C) 1989,1990,1991,1992 by
#	Wilfried Koch, Andreas Lampen, Axel Mahler, Juergen Nickelsen,
#	Wolfgang Obst and Ulrich Pralle 
# 
# This file is part of shapeTools.
#
# 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 interface
#
# $Header: Makefile[1.10] Wed Mar 11 15:06:23 1992 nickel@cs.tu-berlin.de accessed $
#

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

# The base directory of the project's development area.

BASE = /home/stone/shape/development

# Path of a subsystem relative to the root of the system hierarchy
# (e.g. vc/save)

NODEPATH = src/interface

# A short name for the (sub)system (used for building the release ID)

NODENAME = shape_IF

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

HOSTSYSTEM = s-sunos_4

# The processor type (not used in the default setup !)
#	(if your system has an "arch" command, you may set HOSTTYPE = `arch`)

HOSTTYPE = sun4

# Preprocessor switches. (eg. -DSTATISTICS)

SWITCHES = 

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

INSTALLBASE = /usr/local
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.

LIBPATH     = $(BASE)/lib
INCLUDEPATH = $(BASE)/include

# --------------------------------------------------------------------
#		the system's components
# --------------------------------------------------------------------

#
# The system (program, library, etc.) to be built. If you want to
# manage multiple programs, you should introduce multiple targets
# (like TARGET1 TARGET2 or any better names). In this case you 
# have to adjust the system building actions accordingly.

TARGET =

# 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 names of the subdirectories containing subsystems which are also
# to be built.

SUBSYSTEMS = 

# Aliases for (filesystem links to) $(TARGET).

ALIASES = 

# The regular source and header files.

SOURCES = callp-err.el shapetools.el README

HEADERS = 

# Auxiliary source and header files that are not genuine part of the
# system (eg. a test environment). These will also be processed on
# system building, but will *not* be included in releases.

AUXSOURCES = 

AUXHEADERS = 

# Interface header files. These are the heder files to be installed
# together with eg. a library. $(IFHEADERS) usually is a subset of
# $(HEADERS).

IFHEADERS = 

# The manuals

MANUALS = $(MAN1) $(MAN3) $(MAN4) $(MAN5) $(MAN6) $(MAN7) $(MAN8)
MAN1 = 
MAN3 = 
MAN4 = 
MAN5 = 
MAN6 = 
MAN7 = 
MAN8 = 

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

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

# The derived files. All files, that are automatically produced during
# a build process should be listed here.

OBJECTS = callp-err.elc shapetools.elc $(VERSIONOBJECT)

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

CC = cc
CFLAGS  = -I$(INCLUDEPATH) $(SWITCHES) -O
LDFLAGS = -s

RANLIB  = /usr/bin/ranlib
# System V doesn't know ranlib. A good replacement is
# RANLIB  = touch

# System libraries, local libraries and lint libraries.

SYSLIBS   = 
LOCALLIBS = $(LIBPATH)/libafstk.a $(LIBPATH)/libafs.a
LINTLIBS  =


# --------------------------------------------------------------------
#			the targets
# --------------------------------------------------------------------

# The default action (do not change)

all: +all $(ALLTARGETS)

# The final system building action.

targets: $(OBJECTS)

callp-err.elc : callp-err.el
	PWD=`pwd` emacs -batch -f batch-byte-compile callp-err.el

shapetools.elc : shapetools.el callp-err.el
	PWD=`pwd` emacs -batch -l ./callp-err.elc -f batch-byte-compile shapetools.el

# Construction of a library would look like:
#$(TARGET): $(OBJECTS)
#	ar ruv $(TARGET) $(OBJECTS); \
#	$(RANLIB) $(TARGET)

installtargets: $(INSTALLBINPATH)/$(TARGET) installmanuals

$(INSTALLBINPATH)/$(TARGET): $(TARGET)
	@echo "installing $(TARGET) in $(INSTALLBINPATH)"; \
	rm -f $(INSTALLBINPATH)/$(TARGET); \
	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

#installtargets: $(INSTALLLIBPATH)/$(TARGET) installmanuals
#
#$(INSTALLLIBPATH)/$(TARGET): $(TARGET)
#	@echo "installing $(TARGET) in $(INSTALLLIBPATH)"; \
#	if [ -f $(INSTALLLIBPATH)/$(TARGET) ] ;\
#	then \
#	mv -f $(INSTALLLIBPATH)/$(TARGET) \
#	      $(INSTALLLIBPATH)/$(TARGET).old;\
#	fi; \
#	rm -f $(INSTALLLIBPATH)/$(TARGET); \
#	cp $(TARGET) $(INSTALLLIBPATH)/$(TARGET); \
#	chmod $(INSTALLLIBMODE) $(INSTALLLIBPATH)/$(TARGET); \
#	$(RANLIB) $(INSTALLLIBPATH)/$(TARGET)

installmanuals: $(MANUALS)
	@_manuals="$(MAN1)"; \
	for i in $$_manuals; \
	do \
	  echo "installing $$i in $(INSTALLMANPATH)/man1"; \
	  rm -f $(INSTALLMANPATH)/man1/$$i; \
	  cp $$i $(INSTALLMANPATH)/man1/$$i; \
	  chmod $(INSTALLMANMODE) $(INSTALLMANPATH)/man1/$$i; \
	done

installincludes: $(IFHEADERS)
	@_includes="$(IFHEADERS)"; \
	for i in $$_includes; \
	do \
	  echo "installing $$i in $(INSTALLINCPATH)"; \
	  rm -f $(INSTALLINCPATH)/$$i; \
	  cp $$i $(INSTALLINCPATH)/$$i; \
	  chmod $(INSTALLINCMODE) $(INSTALLINCPATH)/$$i; \
	done

# Build a TAGS file from all sources

tags: TAGS
TAGS: $(SOURCES)
	etags $(SOURCES)

# The cleanup action. Removes all automatically rederivable files.

doclean:
	rm -f $(TARGET) $(ALIASES) $(OBJECTS)

# Recursive builds. Performed *before* building $(TARGET)

subsystems:
	@_subsystems="$(SUBSYSTEMS)"; \
	for i in $$_subsystems; \
	do \
	  (cd $$i; $(MAKE) \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" \
		VERSIONBINDING=$(VERSIONBINDING) \
		COMPILER=$(COMPILER) \
		QUALITY=$(QUALITY) \
		TOTALRELEASEBASE=$(TOTALRELEASEBASE) \
		PARTIALRELEASEBASE=$(PARTIALRELEASEBASE) \
		ALLTARGETS= \
		MAINTARGET= \
		SHAPELIBPATH=$(SHAPELIBPATH) $(MAINTARGET) ); \
	done

# --------------------------------------------------------------------
#			internals (do not modify)
# --------------------------------------------------------------------

install: +install $(ALLTARGETS)

clean: +clean $(ALLTARGETS)

+all:
	@-if [ -n "$(ALLTARGETS)" ]; \
	then : ; \
	else \
	  $(MAKE) ALLTARGETS="subsystems targets" MAINTARGET=all \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" \
		VERSIONBINDING=$(VERSIONBINDING) \
		COMPILER=$(COMPILER) \
		QUALITY=$(QUALITY) \
		TOTALRELEASEBASE=$(TOTALRELEASEBASE) \
		PARTIALRELEASEBASE=$(PARTIALRELEASEBASE) \
		SHAPELIBPATH=$(SHAPELIBPATH) all; \
	fi

+install:
	@-if [ -n "$(ALLTARGETS)" ]; \
	then : ; \
	else \
	  $(MAKE) ALLTARGETS="subsystems installtargets" \
		MAINTARGET=install \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" \
		VERSIONBINDING=$(VERSIONBINDING) \
		COMPILER=$(COMPILER) \
		QUALITY=$(QUALITY) \
		TOTALRELEASEBASE=$(TOTALRELEASEBASE) \
		PARTIALRELEASEBASE=$(PARTIALRELEASEBASE) \
		SHAPELIBPATH=$(SHAPELIBPATH) install; \
	fi

+clean:
	@-if [ -n "$(ALLTARGETS)" ]; \
	then : ; \
	else \
	  $(MAKE) ALLTARGETS="subsystems doclean" MAINTARGET=clean \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" \
		VERSIONBINDING=$(VERSIONBINDING) \
		COMPILER=$(COMPILER) \
		QUALITY=$(QUALITY) \
		TOTALRELEASEBASE=$(TOTALRELEASEBASE) \
		PARTIALRELEASEBASE=$(PARTIALRELEASEBASE) \
		SHAPELIBPATH=$(SHAPELIBPATH) clean; \
	fi
