#**************************************************************************
#
#	Copyright (c) 2000-2001  ICP Electronics Inc.  All Rights Reserved.
#
#	FILE:
#		Makefile
#
#	Abstract: 
#		Makefile for uLinux utility library.
#
#	Commnet : 
#		Please use root user to make install & testlock
#
#	HISTORY:
#		03/23/01	Meiji Chang Modified from Nick's
#		09/01/00 	Nick
#				The llseek cannot compile with -fPIC option
#**************************************************************************

PROMISE=y
# It represent you has install one promise disk card

#DEBUG=y
# if you want to run on embed system, please define EMBED, otherwise
# not define anything 

#ifeq ($(DEBUG),y)
#  CFLAG_1 = -fPIC -Wall -c -g -I./ -I../config -I../NAS -I../uLinux -I../../Utilities/Nick_Lib/EMBED/public_lib -DEMBED -DDEBUG 
#else
# CFLAG_1 = -fPIC -Wall -c -I./ -I../config -I../NAS -I../uLinux -I../../Utilities/Nick_Lib/EMBED/public_lib -DEMBED 
#endif

#ifeq ($(PROMISE),y)
#  CFLAG=$(CFLAG_1) -DPROMISE
#else
#  CFLAG=$(CFLAG_1)
#endif


TARGET = libDS_hd_lib
CC = gcc
CFLAG = -fPIC -Wall -c -DPROMISE
INCLUDE = -I../uLinux -I../include 


# To enable debug message dump, un-comment the following flag
#DEBUG_FLAG = -g -DDEBUG	

OBJS = soft-raid.o llseek.o ds_fdisk.o 

all: 	$(OBJS)
	$(CC) $(DEBUG_FLAG) -shared -Wl,-soname,${TARGET}.so.0 -o ${TARGET}.so.0.0 ${OBJS} -L$(ROOT_PATH)/usr/lib -lc -luLinux_NAS -luLinux_Util -lDS_public_lib

llseek.o : llseek.c 
	$(CC) -Wall -c $(INCLUDE) $(DEBUG_FLAG) llseek.c -o llseek.o

%.o : %.c 
	$(CC) $(CFLAG) $(INCLUDE) $(DEBUG_FLAG) $< -o $@

install:
	objcopy --strip-all $(TARGET).so.0.0
	cp -av $(TARGET).so.0.0  $(TARGET_PREFIX)/usr/lib
	ln -sf /usr/lib/$(TARGET).so.0.0  $(TARGET_PREFIX)/usr/lib/$(TARGET).so.0
	ln -sf /usr/lib/$(TARGET).so.0  $(TARGET_PREFIX)/usr/lib/$(TARGET).so 
clean:
	rm -f *.o 
	rm -f $(TARGET).so.0.0
	rm -f *~
