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

if [ _$load_obj != _ ]; then more_targets=xlib.pre; 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

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.h

C=	client.c\\
	color.c\\
	colormap.c\\
	cursor.c\\
	display.c\\
	error.c\\
	event.c\\
	extension.c\\
	font.c\\
	gcontext.c\\
	grab.c\\
	graphics.c\\
	init.c\\
	key.c\\
	objects.c\\
	pixel.c\\
	pixmap.c\\
	property.c\\
	text.c\\
	type.c\\
	util.c\\
	window.c\\
	wm.c

O=	client.o\\
	color.o\\
	colormap.o\\
	cursor.o\\
	display.o\\
	error.o\\
	event.o\\
	extension.o\\
	font.o\\
	gcontext.o\\
	grab.o\\
	graphics.o\\
	init.o\\
	key.o\\
	objects.o\\
	pixel.o\\
	pixmap.o\\
	property.o\\
	text.o\\
	type.o\\
	util.o\\
	window.o\\
	wm.o

all: \$(O) $more_targets

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

client.o:	\$(H) client.c
color.o:	\$(H) color.c
colormap.o:	\$(H) colormap.c
cursor.o:	\$(H) cursor.c
display.o:	\$(H) display.c
error.o:	\$(H) error.c
event.o:	\$(H) event.c
extension.o:	\$(H) extension.c
font.o:		\$(H) font.c
gcontext.o:	\$(H) gcontext.c
grab.o:		\$(H) grab.c
graphics.o:	\$(H) graphics.c
init.o:		\$(H) init.c
key.o:		\$(H) key.c
objects.o:	\$(H) objects.c
pixel.o:	\$(H) pixel.c
pixmap.o:	\$(H) pixmap.c
property.o:	\$(H) property.c
text.o:		\$(H) text.c
type.o:		\$(H) type.c
util.o:		\$(H) util.c
window.o:	\$(H) window.c
wm.o:		\$(H) wm.c

EOT
if [ _$load_obj != _ ]; then
cat <<EOT >>Makefile.local
xlib.pre: \$(O)
	../../scripts/linkext-$load_obj \$@ \$(O)

install: xlib.pre
	-@if [ ! -d $lib_dir ]; then \\
	    echo mkdir $lib_dir; \\
	    mkdir $lib_dir; \\
	fi
	cp xlib.pre $lib_dir/xlib.o
EOT
else
cat <<EOT >>Makefile.local
install:
EOT
fi
cat <<EOT >>Makefile.local

lint:
	lint \$(LINTFLAGS) -I\$(INC) $x11_incl \$(C)

clean:
	rm -f *.o xlib.pre core

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