. ../../config/system
. ../../config/site

if [ _$load_obj != _ ]; then
    linkext="../../scripts/linkext-$load_obj \$@ \$@"
fi

echo Building Makefile.local...
cat <<EOT >Makefile.local
# This Makefile was produced by running ./build in this directory.

SHELL=/bin/sh

CC= ${cc-cc}
CFLAGS= $cflags $obj_cflags
LINTFLAGS= $lintflags
SCMFLAGS= -p .:../../scm:../xt

INC=	../../include

H=	\$(INC)/config.h\\
	\$(INC)/param.h\\
	\$(INC)/object.h\\
	\$(INC)/extern.h\\
	\$(INC)/misc.h\\
	\$(INC)/stkmem.h\\
	\$(INC)/cstring.h\\
	../xlib/xlib.h\\
	../xt/xt.h

O=	ascii.o\\
	box.o\\
	clock.o\\
	command.o\\
	dialog.o\\
	form.o\\
	grip.o\\
	label.o\\
	list.o\\
	menubutton.o\\
	paned.o\\
	panner.o\\
	porthole.o\\
	repeater.o\\
	scrollbar.o\\
	shell.o\\
	simplemenu.o\\
	sme.o\\
	smebsb.o\\
	smeline.o\\
	stripchart.o\\
	toggle.o\\
	tree.o\\
	viewport.o

WIDGET_SET= xaw

.SUFFIXES: .d .c .o

.c.o:
	\$(CC) \$(CFLAGS) -I\$(INC) $x11_incl -c \$<
	$linkext

.d.c:
	../../src/scheme \$(SCMFLAGS) -l make-widget \$< \$@ \$(WIDGET_SET)

.d.o:
	../../src/scheme \$(SCMFLAGS) -l make-widget \$< \$*.c \$(WIDGET_SET)
	\$(CC) \$(CFLAGS) -I\$(INC) $x11_incl -c \$*.c
	$linkext

all: \$(O)

ascii.o:	\$(H) ascii.d
box.o:		\$(H) box.d
clock.o:	\$(H) clock.d
command.o:	\$(H) command.d
dialog.o:	\$(H) dialog.d
form.o:		\$(H) form.d
grip.o:		\$(H) grip.d
label.o:	\$(H) label.d
list.o:		\$(H) list.d
menubutton.o:	\$(H) menubutton.d
paned.o:	\$(H) paned.d
panner.o:	\$(H) panner.d
porthole.o:	\$(H) porthole.d
repeater.o:	\$(H) repeater.d
scrollbar.o:	\$(H) scrollbar.d
shell.o:	\$(H) shell.d
simplemenu.o:	\$(H) simplemenu.d
sme.o:		\$(H) sme.d
smebsb.o:	\$(H) smebsb.d
smeline.o:	\$(H) smeline.d
stripchart.o:	\$(H) stripchart.d
toggle.o:	\$(H) toggle.d
tree.o:		\$(H) tree.d
viewport.o:	\$(H) viewport.d

install:
	-@if [ ! -d $lib_dir ]; then \\
	    echo mkdir $lib_dir; \\
	    mkdir $lib_dir; \\
	fi
	-@if [ ! -d $lib_dir/xaw ]; then \\
	    echo mkdir $lib_dir/xaw; \\
	    mkdir $lib_dir/xaw; \\
	fi
	@for i in \$(O) ALIASES ;\\
	do \\
	    echo cp \$\$i $lib_dir/xaw; \\
	    cp \$\$i $lib_dir/xaw; \\
	done

lint:
	lint \$(LINTFLAGS) -I\$(INC) $x11_incl *.c

clean:
	rm -f *.o *.c core

distclean:
	rm -f *.o *.c core lint.out Makefile.local
EOT
