#
# This script creates a makefile for A++ to be executed
# with GNUMake and the GNU/C++ Development System.
#

# open the output file
echo "Creating GNU 'makefile'.."
rm makefile
open makefile w 1

echo "#"^j\
"# GNU Makefile for the A++ Test programs"^j\
"# Copyright (C)1994 by Armin Vogt"^j\
"#"^j\
"# This makefile has been created automatically with 'maketst'"^j\
"# "$Id: maketst,v 1.2 1994/08/02 18:58:28 Armin_Vogt Exp Armin_Vogt $^j\
"#"^j^j\
"TESTPRGS        =      /apphome/TESTPRGS/"^j\
"APPINCLUDE      =      /appinclude/"^j\
^j"#"^j"# if the Commodore headers are not present in gcc:os-include"^j\
"# define their path here.."^j\
"CHEADERS        =      /include"^j\
""^j\
""^j\
"CC      =  g++"^j\
"CFLAGS  =  -O2"^j\
^j\
"LIBNAME    =	aplusplus"^j\
"LIBDIR     = /apphome/gnuc++/APPlibrary"^j\
"LOADLIBES = -L$(LIBDIR) -l$(LIBNAME) -lauto"^j^j\
"ERRORPIPE  =  pipe:gnu_errors"^j\
""^j\
""^j >.1


alias ALL        "*p%c exec set p $p; foreach s ( $p ) $c"

#
# IMPORTANT NOTE: GNU Make demands a tab character leading each
# action line!! '^i' prints a tab.
#

echo "COMPILE = $(CC) -c -I/gcc/include -I$(APPINCLUDE) -I$(CHEADERS) $(CFLAGS) $< >$(ERRORPIPE)"^j >.1

echo ^j"# The order of include directory declarations in crucial when"^j\
"# CHEADERS is used. GNU standard headers must have a higher priority"^j\
"# than the ones in the CHEADERS (usually SAS standard headers!!)"^j >.1




echo "Making TESTPRG dependencies.."

#
# create testprg dep.: all files present in the TESTPRGS sub-directories
# are included.
#

cd apphome:testprgs
unset file
unset path
echo ^j"all: \\" >.1
ALL */*.cxx "strhead path .cxx $s;strtail file / $path;echo \" \"$file\\\\" >.1
unset file
unset path
echo ^j >.1
ALL */*.cxx "strhead path .cxx $s;strtail file / $path;echo ^j"$file: $file.o"^j^j"$file.o:  "\"$\""(TESTPRGS)$path.cxx"^j^i\"$\""(COMPILE)"  >.1
dswap

# close created output file
close 1
echo "done."
