# This is the makefile for a netscape pipe overflow patch
# There are many variants of Linux distributions and
# Netscapes and the tools that could be used for an
# automatic detections have flaws. Please, set the
# next two variables to match your system

# The location of your libc library, matching your version
# of Netscape. Mostly /lib/libc.so.6 for a glibc-based Netscape
# and /lib/libc.so.5 for a libc5-version. NOTE: The Netscape
# can use different libc as the default for your distribution is.
LIBC=/lib/libc.so.6

# The matching dynamic loader library. Generally /lib/libdl.so.1
# for libc5 and /lib/libdl.so.2 for glibc.
LIBDL=/lib/libdl.so.2


DEST=libnspipepatch.so
DESTDIR=/usr/local/lib

$(DEST): nspipepatch.o
	ld -shared -o $@ $(LIBDL) $<

nspipepatch.o:	nspipepatch.c
	$(CC) -c -DLIBC=\"$(LIBC)\" $<

all:	$(DEST)

clean:
	rm $(DEST) nspipepatch.o

install: $(DEST)
	cp $(DEST) $(DESTDIR)
	chown root.root $(DESTDIR)/$(DEST)
	chmod 755 $(DESTDIR)/$(DEST)
	@echo ""
	@echo "Please, set the environment variable LD_PRELOAD to"
	@echo "$(DESTDIR)/$(DEST) somewhere where the"
	@echo "netscape (and only netscape) can see it when starting."
	@echo ""

