SAMBA3_APPS_NATIVE_ICONV ?= no

all:
	@if [ ! -e ./source/Makefile ];then \
	cd ./source; ac_cv_lib_resolv_dn_expand=no ac_cv_lib_resolv__dn_expand=no ac_cv_lib_resolv___dn_expand=no  ac_cv_func_prctl=no SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes linux_getgrouplist_ok=no samba_cv_fpie=no samba_cv_have_longlong=yes samba_cv_HAVE_INO64_T=yes samba_cv_HAVE_OFF64_T=yes samba_cv_HAVE_STRUCT_FLOCK64=yes samba_cv_SIZEOF_OFF_T=yes samba_cv_HAVE_MMAP=yes samba_cv_HAVE_FTRUNCATE_EXTEND=yes samba_cv_REPLACE_READDIR=no samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no samba_cv_HAVE_SENDFILE=no samba_cv_HAVE_SENDFILE64=no samba_cv_HAVE_WRFILE_KEYTAB=yes samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes samba_cv_HAVE_IFACE_IFCONF=yes samba_cv_have_setresgid=yes samba_cv_have_setresuid=yes samba_cv_USE_SETRESUID=yes samba_cv_USE_SETREUID=yes samba_cv_HAVE_GETTIMEOFDAY_TZ=yes samba_cv_REALPATH_TAKES_NULL=no samba_cv_HAVE_FCNTL_LOCK=yes samba_cv_HAVE_SECURE_MKSTEMP=yes samba_cv_HAVE_NATIVE_ICONV=$(SAMBA3_APPS_NATIVE_ICONV) samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no samba_cv_HAVE_BROKEN_GETGROUPS=no samba_cv_HAVE_BROKEN_READDIR_NAME=no samba_cv_HAVE_C99_VSNPRINTF=yes samba_cv_HAVE_DEV64_T=no samba_cv_HAVE_DEVICE_MAJOR_FN=yes samba_cv_HAVE_DEVICE_MINOR_FN=yes samba_cv_HAVE_IFACE_AIX=no samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no samba_cv_HAVE_KERNEL_SHARE_MODES=yes samba_cv_HAVE_MAKEDEV=yes samba_cv_HAVE_TRUNCATED_SALT=no samba_cv_HAVE_UNSIGNED_CHAR=no samba_cv_HAVE_WORKING_AF_LOCAL=yes samba_cv_HAVE_Werror=yes samba_cv_REPLACE_INET_NTOA=no samba_cv_SIZEOF_DEV_T=yes samba_cv_SIZEOF_INO_T=yes samba_cv_SIZEOF_TIME_T=no CPPFLAGS="-DNDEBUG -DSHMEM_SIZE=524288 -Dfcntl=fcntl64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_LARGE_FILES=1" CFLAGS="-funit-at-a-time -Wno-pointer-sign -Os -ffunction-sections -fdata-sections $(SAMBA3_APPS_CFLAGS)" ./configure --host=$(subst linux-,linux,$(CROSS_COMPILE)) --build=i586-suse-linux --prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libdir=/lib --localstatedir=/var/samba --with-configdir=/var/samba --with-rootsbindir=/usr/sbin --with-piddir=/var/samba --with-privatedir=/var/samba --with-lockdir=/var/samba/lock --with-syslog --with-included-popt=no --with-krb5=no --enable-shared --disable-static --disable-cups --disable-iprint --disable-pie --disable-fam --disable-dmalloc --disable-krb5developer --disable-developer --disable-debug --without-ads --without-acl-support --without-ldap --without-cifsmount --without-cifsupcall --without-cluster-support --without-sendfile-support --without-utmp --without-winbind --without-quotas --without-sys-quotas ; \
	fi
	@mkdir -p source/bin
	@$(MAKE) -C ./source srcdir=./

install: all
	@install -m 755 source/bin/smbd $(ROOTFS_DIR)/usr/sbin/smbd
	@$(RSTRIP) $(ROOTFS_DIR)/usr/sbin/smbd
	@install -m 755 source/bin/nmbd $(ROOTFS_DIR)/usr/sbin/nmbd
	@$(RSTRIP) $(ROOTFS_DIR)/usr/sbin/nmbd
	@install -m 755 source/bin/smbpasswd $(ROOTFS_DIR)/usr/sbin/smbpasswd
	@$(RSTRIP) $(ROOTFS_DIR)/usr/sbin/smbpasswd
	@install -D source/bin/libbigballofmud.so $(ROOTFS_DIR)/lib/libbigballofmud.so
	@install -D source/bin/libbigballofmud.so $(PROJ_STAGINGDIR)/lib/libbigballofmud.so
	@install -D source/bin/libbigballofmud.a $(PROJ_STAGINGDIR)/lib/libbigballofmud_pic.a

clean:
	@if [ -f ./source/Makefile ];then $(MAKE) -C ./source distclean srcdir=./;fi;
	@rm -f $(ROOTFS_DIR)/usr/sbin/smbd
	@rm -f $(ROOTFS_DIR)/usr/sbin/nmbd
	@rm -f $(ROOTFS_DIR)/usr/sbin/smbpasswd
	@rm -f $(ROOTFS_DIR)/lib/libbigballofmud.so
	@rm -f $(PROJ_STAGINGDIR)/lib/libbigballofmud.so
	@rm -f $(PROJ_STAGINGDIR)/lib/libbigballofmud_pic.a

