# src/bsd/jhs/bin/public/xfed/Makefile
# by jhs@ Little stand alone makefile to avoid getting involved with imake,
# and/or compiling whole contrib tree.
NO_OBJ=YES
# JJLATER NO_OBJ might be need for the y. yacc stuff ?
BITS = icon.bit save.bit quit.bit next.bit prev.bit forward.bit backward.bit
#SRCS = parse.y scan.l output.c main.c $(BITS)
OBJS = parse.o scan.o output.o main.o
CFLAGS += -I/usr/local/include

# for esix:	LDFLAGS = -lX11 -ll -lnsl_i -lsockdns
# for 386bsd:	LDFLAGS = /usr/X386/lib/libX11.a -ll -lnsl_i -lsockdns
# for 386bsd:	LDFLAGS = -lX11 -ll -lnsl_i -lsockdns
# for FreeBSD-current 940426:	LDFLAGS = -lX11 -ll
# for FreeBSD-current 951013:	LDFLAGS = -L/usr/local/lib -lX11 -ll
LDFLAGS = -L/usr/local/lib -lX11 -ll

all: xfed

install:
	install -c xfed /usr/bin/vsl
	install -c xfed.man /usr/share/man/man1/xfed.1

xfed: $(OBJS)
	gcc -o ${.CURDIR}/$@ $(OBJS) $(LDFLAGS)
scan.o:		y.tab.h defs.h scan.l
		rm -f lex.yy.c
		lex scan.l
		$(CC) $(CFLAGS) -c lex.yy.c
		mv lex.yy.o scan.o
y.tab.h:	parse.y
y.tab.c:	parse.y
		-rm -f y.tab.c
		yacc -d parse.y
parse.o:	defs.h y.tab.c
		$(CC) $(CFLAGS) -c y.tab.c
		mv y.tab.o parse.o
main.o:		defs.h $(BITS)
output.o:	defs.h
clean:
		rm -f lex.yy.c y.tab.c y.tab.h xfed
		rm -f $(OBJS) tags core

DIFFS = Imakefile backward.bit forward.bit main.c makefile next.bit \
	prev.bit xfed.man
ORIG_D = ../xfed.orig
# SVR4 make forks a csh (not sh) per line, so no for loop used.
patches: $(DIFFS)
	echo "Patches for X11R5/contrib/clients/xfed"		 > ${.CURDIR}/$@
	echo "Generated by Julian H. Stacey jhs@ `date`"	>> ${.CURDIR}/$@
	echo "forward.bit and backward.bit are new files"	>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/xfed.man	xfed.man		>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/main.c	main.c			>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/Imakefile	Imakefile		>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/backward.bit	backward.bit		>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/forward.bit	forward.bit		>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/makefile	makefile		>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/next.bit	next.bit		>> ${.CURDIR}/$@
	-diff -c $(ORIG_D)/prev.bit	prev.bit		>> ${.CURDIR}/$@

.include <bsd.prog.mk>
.include <berklix.mk>   # Needed to support recursive make html from above.
