IOP_CFLAGS = -DPS2_IOP_PLATFORM -DHAVE_STRING_H \
	  -DHAVE_STDINT_H -DHAVE_SYS_TYPES_H \
	  -D_U_=/**/
IOP_CFLAGS += -Wall -Os -I. -I../include -I../include/smb2

IOP_LIB = libsmb2.a
IOP_OBJS =  aes.o \
            aes128ccm.o \
            alloc.o \
	    compat.o \
            dcerpc.o \
            dcerpc-lsa.o \
            dcerpc-srvsvc.o \
            errors.o \
            init.o \
            hmac.o \
            hmac-md5.o \
            krb5-wrapper.o \
            libsmb2.o \
            md4c.o \
            md5.o \
            ntlmssp.o \
            pdu.o \
            sha1.o \
            sha224-256.o \
            sha384-512.o \
            smb2-cmd-close.o \
            smb2-cmd-create.o \
            smb2-cmd-echo.o \
            smb2-cmd-error.o \
            smb2-cmd-flush.o \
            smb2-cmd-ioctl.o \
            smb2-cmd-logoff.o \
            smb2-cmd-negotiate.o \
            smb2-cmd-query-directory.o \
            smb2-cmd-query-info.o \
            smb2-cmd-read.o \
            smb2-cmd-session-setup.o \
            smb2-cmd-set-info.o \
            smb2-cmd-tree-connect.o \
            smb2-cmd-tree-disconnect.o \
            smb2-cmd-write.o \
            smb2-data-file-info.o \
            smb2-data-filesystem-info.o \
            smb2-data-security-descriptor.o \
            smb2-data-reparse-point.o \
            smb2-share-enum.o \
            smb3-seal.o \
            smb2-signing.o \
            socket.o \
            sync.o \
            timestamps.o \
            unicode.o \
            usha.o

all: $(IOP_LIB)

clean:
	rm -f -r $(IOP_BIN) $(IOP_LIB) $(IOP_OBJS) obj

install: all
ifeq ($(PS2SDK),)
	@echo "$PS2SDK is not set. Can not install libsmb2."
	@exit 1
endif
	@echo Copying...
	@[ -d $(PS2SDK)/iop/include/smb2 ] || mkdir -p $(PS2SDK)/iop/include/smb2
	@cp -frv ../include/smb2/*.h $(PS2SDK)/iop/include/smb2
	@cp -frv *.a $(PS2SDK)/iop/lib
	@echo Done!

include $(PS2SDK)/Defs.make
include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.iopglobal
