# makefile for smblib
# Type make system, where system is ULTRIX, DU, DECOSF1, Solaris etc
CC = gcc
# CC = cc
#CFLAGS = -g -DDEBUG 
# Uncomment the above if you want debugging output ...
# comment the below out if you want debugging
# remove the ULTRIX if you are not running on ULTRIX ...
#ULTRIX 
#CFLAGS = -g -DULTRIX 
#LDFLAGS = 
#
# Solaris and perhaps SunOS
#CFLAGS = -g -DSUN
#LDFLAGS = -lsocket -lnsl
#
# Linux
#CFLAGS = -g -DLinux
#LDFLAGS = 
#
#HP-UX
#CFLAGS = -g -DHPUX
#LDFLAGS = ???

INCLUDES = smblib.h smblib-priv.h

RFCNB = ../rfcnb/session.o ../rfcnb/rfcnb-util.o ../rfcnb/rfcnb-io.o

OBJS = smblib.o smblib-util.o file.o smb-errors.o exper.o smblib-api.o

.SUFFIXES: .c .o .h

first:
	@echo "Usage: make <system>"
	@echo "Where <system> can be: ULTRIX, DU, Solaris, Linux ..."

ULTRIX:
	make CFLAGS="-g -DULTRIX" LDFLAGS="" CC="$(CC)" all

DU DECOSF1:
	make CFLAGS="-g -DOSF -DDigital_UNIX" LDFLAGS="" CC="$(CC)" all

Linux:
	make CFLAGS="-g -DLinux" LDFLAGS="" CC="$(CC)" all

Solaris:
	make CFLAGS="-g -DSolaris" LDFLAGS="-lsocket -lnsl" CC="$(CC)" \
	all

all:	test_smblib test_chained test_perf test_password test_chgpwd 

.c.o:	$(INCLUDES)
	@echo Compiling $*.c
	$(CC) $(CFLAGS) -c $*.c

test_smblib:	test_smblib.o $(OBJS) $(RFCNB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o test_smblib test_smblib.o \
	$(OBJS) $(RFCNB)

test_chained:	test_chained.o $(OBJS) $(RFCNB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o test_chained test_chained.o \
	$(OBJS) $(RFCNB)

test_perf: 	test_perf.o $(OBJS) $(RFCNB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o test_perf test_perf.o $(OBJS) $(RFCNB)

test_password: test_password.o $(OBJS) $(RFCNB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o test_password test_password.o \
	$(OBJS) $(RFCNB)

test_chgpwd: test_chgpwd.o $(OBJS) $(RFCNB)
	$(CC) $(CFLAGS) $(LDFLAGS) -o test_chgpwd test_chgpwd.o \
	$(OBJS) $(RFCNB)

$(RFCNB):
	cd ../rfcnb; make CC="$(CC)" LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)"

clean:
	rm *.o test_smblib test_chained test_perf test_chgpwd \
	test_password
	cd ../rfcnb; make clean

