##
## Copyright (c)  1995 - 2000, The Hebrew University of Jerusalem.
## All rights reserved.
##
## Permission to use, copy and distribute this software is hereby granted
## under the terms of version 2 or any later version of the GNU General
## Public License, as published by the Free Software Foundation.
##
## You should have received a copy of the GNU General Public License along
## with this package; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## THE HEBREW UNIVERSITY OF JERUSALEM  PROVIDES THIS SOFTWARE IN ITS "AS IS"
## CONDITION. THE HEBREW UNIVERSITY OF JERUSALEM DISCLAIMS  ANY LIABILITY OF
## ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
##

##
## Author(s): Ariel Eizenberg
##

include ../../Rules.make

SRC 	= msx_admin.c msx_decay.c msx_info.c msx_node.c msx_p.c msx_self.c \
          libmosix.c dadvise.c msxctl.c

OBJ 	= $(subst .c,.o,$(SRC))

CFLAGS  += -fPIC
LDFLAGS = -shared
LIBS    = libmos.a libmos.so

all: $(LIBS)

install: all
	$(INSTALL) -d -m 755 $(PREFIX)
	$(INSTALL) -d -m 755 $(PREFIX)/lib
	$(INSTALL) -d -m 755 $(PREFIX)/include
	$(INSTALL) -s libmos.a $(PREFIX)/lib
	$(INSTALL) -c -m 644 libmos.so $(PREFIX)/lib
	$(INSTALL) -c -m 644 libmosix.h mos.h $(PREFIX)/include
	/sbin/ldconfig

libmos.a: $(OBJ)
	ar crv $@ $?
	ranlib $@

libmos.so: $(OBJ)
	$(CC) $(LDFLAGS) -o $@.0 -Wl,-soname,$@.0 $?
	ln -sf $@.0 $@

clean: 
	$(CLEANALL)
	$(CLEANLIBS)
