#
#	This Makefile will not work with the
#	pre-SunPro version of make (i.e., any
#	pre-SunOS 3.5 default installation).
#
#	ARCH must be set in the environment
#	to the architecture type of the machine,
#	e.g., sun3, sun4, etc., and a subdirectory
#	of the same name must be present in this
#	source directory.
#
#	FLOAT may optionally be set in the
#	environment to an appropriate floating
#	point compile flag, e.g., -f68881, -ffpa, etc.
#
.KEEP_STATE:

.PRECIOUS:	liblxt_$(ARCH).a

CC=	cc
#CFLAGS= $(FLOAT) -g -D$(ARCH)
CFLAGS= $(FLOAT) -O -D$(ARCH) -I/usr/usc/X11/include -I/usr/openwin/include
TROFF=	ptroff

HEADERS= \
	lxt.h

LIBSRCS= \
	menu.c \
	menu_item.c \
	cursor.c \
	image.c \
	panel.c \
	panel_item.c \
	panel_draw.c \
	panel_evt.c \
	panel_conf.c \
	panel_block.c \
	panel_label.c \
	panel_text.c \
	panel_button.c \
	panel_slider.c \
	panel_enum.c \
	panel_choice.c \
	panel_cycle.c \
	panel_toggle.c \
	alert.c \
	canvas.c \
	canvas_conf.c \
	canvas_evt.c \
	canvas_draw.c \
	textsw.c \
	textsw_evt.c \
	textsw_scroll.c \
	textsw_hlt.c \
	textsw_paste.c \
	textsw_exit.c \
	textsw_get.c \
	textsw_set.c \
	textsw_clear.c \
	textsw_select.c \
	select.c \
	lxt_evt.c

LIBOBJS= $(LIBSRCS:%.c=%.o)

LIBRARY= liblxt_$(ARCH).a

lxt:	$(LIBRARY)

$(LIBRARY): $(HEADERS) $(LIBRARY)($(LIBOBJS) $(ARCH)-dummy.o)
	?@nobjs=`ls $(ARCH) | grep '\.o$$' | wc | awk '{print $$1}'` ; \
	if (test "$$nobjs" != "0") then \
		cd $(ARCH) ; \
		echo ar rv ../$@ "*.o" ; \
		ar rv ../$@ ""*.o"" ; \
		echo ranlib ../$@ ; \
		ranlib ../$@ ; \
		echo rm "*.o" ; \
		rm ""*.o"" ; \
	fi

$(LIBRARY)(%.o): %.c
	?@if (test -f $(ARCH)/$*.o) then \
		echo -n ; \
	else \
		echo "$(CC) $(CFLAGS) -c $< -o $(ARCH)/$(<:.c=.o)" ; \
		$(CC) $(CFLAGS) -c $< -o $(ARCH)/$(<:.c=.o) ; \
	fi

$(LIBRARY)($(ARCH)-dummy.o):
	@echo -n

demo:	FRC
	cd peewee; make demo

doc:	lxt.ms
	$(TROFF) -t -ms lxt.ms >lxt.doc

lint:	FRC
	lint -u *.c >lint.out

backup:	FRC
	tar cvf $(BACKUPDEV) *.c *.h Makefile* BLURB BUGS lxt.ms *.bitmap peewee/Makefile* peewee/*.c peewee/*.bitmap peewee/penpal.letter

dist:	FRC
	tar cvf - Makefile* */.arch lxt.ms *.c *.h *.bitmap liblxt_* peewee/Makefile* peewee/*.c peewee/*.bitmap peewee/penpal.letter | compress >lxt.tar.Z
	-cp lxt.tar.Z /lamont/lamont/ftp/pub

FRC:

