switch cc/soname
	case {}
		put /local/soname {}
		end
	default
		put /local/soname [@@cc/soname@libmawk.so.@/local/version/1@@]
		end
end

print [@
# version of the .so file is SOVER1.SOVER2.SOVER3
SOVER1=@/local/version/1@
SOVER2=@/local/version/2@
SOVER3=@/local/version/3@

PREFIX=@/local/prefix@

#--------------------- hand tweak values ---------------------------------
# TODO: scconfig
SHELL=/bin/sh

# where to put mawk
BINDIR = $(DESTDIR)$(install_root)$(PREFIX)/bin
# where to put libraries
LIBARCHDIR = $(DESTDIR)$(install_root)$(PREFIX)/@/local/libarchdir@
LIBDIR = $(DESTDIR)$(install_root)$(PREFIX)/lib
# where to put include files
INCDIR = $(DESTDIR)$(install_root)$(PREFIX)/include/libmawk
# where to put the man pages
MANDIR = $(DESTDIR)$(install_root)$(PREFIX)/share/man/man1
MAN3DIR = $(DESTDIR)$(install_root)$(PREFIX)/share/man/man3
MAN7DIR = $(DESTDIR)$(install_root)$(PREFIX)/share/man/man7
# where to put the doc
DOCDIR = $(DESTDIR)$(install_root)$(PREFIX)/share/doc/libmawk
MANEXT = 1


#----------------- scconfig detected ----------------------------------
CC = @cc/cc@
CFLAGS = @cc/cflags@ @cc/fpic@ @?/local/nofork@ -I.. -I. $(CFLAGS_APP)
LDFLAGS = @cc/ldflags@
LDFLAGS_SO = @/local/soname@
LDFLAGS_RDYNAMIC = @cc/rdynamic@

CHMODX = @/host/fstools/chmodx@
CHMOD = chmod
MKDIR = @/host/fstools/mkdir@
CP=@/host/fstools/cp@
SYMLINK=@/host/fstools/ln@
@]

switch /local/numeric

case {double} print [@
# Numeric format is double (float enabled)
NUM_OBJ = num_double.o
NUM_SRC = num_double.c
MATHLIB = -lm
@]
end

case {int} print [@
# Numeric format is int (float disabled)
NUM_OBJ = num_int.o
NUM_SRC = num_int.c
MATHLIB =
@]
end
end

print [@
#--- parser generator ---
@]

if ?parsgen/bison/presents then
print [^
# bison found, can generate parse.c
YACC = ^parsgen/bison^ -y --name-prefix=Mawk_

parse.c  : parse.y
	@echo  expect 4 shift/reduce conflicts
	$(YACC) -d parse.y
	mv y.tab.c parse.c
	-if cmp -s y.tab.h parse.h ;\
	   then rm y.tab.h ;\
	   else mv y.tab.h parse.h ; fi
^]
else
print [^
parse.c: parse.y
	@echo  WARNING: Can not generate parse.c from parse.y because bison was not found.
^]
end

