##
## Copyright (c) 2002 David Santo Orcero irbis@orcero.org
## http://www.orcero.org/irbis
## Mosix is (c) of prof. Barak http://www.mosix.org
## OpenMosix is (c) of Moshe Bar http://www.openmosix.com
## Each respective trademark is of its own owner
## All rights reserved.
## This software is distributed under GPL 2
##
## THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTY IS ASSUMED.
## NO LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING
## FROM THE USE OF THIS SOFTWARE WILL BE ACCEPTED. IT CAN BURN
## YOUR HARD DISK, ERASE ALL YOUR DATA AND BROKE DOWN YOUR 
## MICROWAVE OVEN. YOU ARE ADVISED.
##


include ../configuration

CC	=	gcc
SRC	=	fixvfork.c
OBJ	=	fixvfork.o

CFLAGS	+=	-fPIC
LDFLAGS	=	-shared -rdynamic

LIB	=	fixvfork.so

WRAP	=	fixvfork.sh

all:	clean build install


build: fixvfork.so  buildfix 

fixvfork.so:	$(OBJ)
	$(CC) $(LDFLAGS) $(OBJ) -o $(LIB)

buildfix:
	rm -f $(WRAP)
	touch $(WRAP)
	echo "#!/bin/sh" >> $(WRAP)
	echo "export LD_PRELOAD=$(INSTALLDIR)/lib/$(LIB)" >> $(WRAP)
	echo "$$""*" >> $(WRAP)

install:  build
	$(INSTALL) -d -m 0755 $(INSTALLDIR)/lib
	$(INSTALL) -c -m 0644 fixvfork.so $(INSTALLDIR)/lib
	$(INSTALL) -d -m 0755 $(INSTALLDIR)/bin
	$(INSTALL) -c -m 0555 $(WRAP) $(INSTALLDIR)/bin

clean:
	rm -f *.so *.o
	rm -f $(WRAP)

