# Makefile for GNU SED, a batch editor.
# Copyright (C) 1987, 1991 Free Software Foundation, Inc.
#
# Specific modifications for SAS/C++ 6.51 by Andreas Scherer.
#
# This file is NOT part of GNU SED.
# 
# GNU SED 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, or (at your option)
# any later version.
# 
# GNU SED 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 GNU SED; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

#### Start of system configuration section. ####

CC = sc
WMERGE = wmerge
INSTALL = copy clone

# Things you might add to DEFS:
# STDC_HEADERS		If you have ANSI C headers and libraries.
# USG			If you have System V/ANSI C string
#			and memory functions and headers.
# __CHAR_UNSIGNED__	If type `char' is unsigned.
#			gcc defines this automatically.
# NO_VFPRINTF		If you lack vprintf function (but have _doprnt).

DEFS = define=_STRICT_ANSI define=STDC_HEADERS
LIBS =

CFLAGS = math=standard noicons stackextend optimize
LDFLAGS = math=standard noicons
extra_objs = ansialloca.o

prefix = Programmer:other
exec_prefix = $(prefix)

# Prefix for each installed program, normally empty or `g'.
binprefix = 

# Where to install the executable.
bindir = $(exec_prefix)/bin

#### End of system configuration section. ####

objs = ansised.o ansiutils.o ansirx.o ansigetopt.o getopt1.o
srcs = sed.c utils.c rx.c getopt.c getopt1.c alloca.c

distfiles = COPYING COPYING.LIB ChangeLog README ABOUT.RX INSTALL Makefile.in \
  configure configure.in rx.h getopt.h $(srcs)

all_objs= $(objs) $(extra_objs)

all:	sed

install: all
	$(INSTALL) sed $(bindir)/$(binprefix)sed

.c.o:
	$(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) idir=$(srcdir) $<

sed:	$(all_objs)
	$(CC) link to $@ $(LDFLAGS) $(all_objs) $(LIBS)

ansised.o ansirx.o: rx.h 
ansised.o getopt1.o: getopt.h

clean:
	-delete \#?.(bak|lnk|o) ansi\#?.c

veryclean: clean
	-delete sed

ansialloca.o: ansialloca.c 
ansialloca.c: alloca.c alloca.ch
	$(WMERGE) alloca.c alloca.ch ansialloca.c

ansigetopt.o: ansigetopt.c
ansigetopt.c: getopt.c getopt.ch
	$(WMERGE) getopt.c getopt.ch ansigetopt.c

ansirx.o: ansirx.c
ansirx.c: rx.c rx.ch
	$(WMERGE) rx.c rx.ch ansirx.c

ansised.o: ansised.c
ansised.c: sed.c sed.ch
	$(WMERGE) sed.c sed.ch ansised.c

ansiutils.o: ansiutils.c
ansiutils.c: utils.c utils.ch
	$(WMERGE) utils.c utils.ch ansiutils.c
