1include ../common.mak
2
3#srcdir=source
4srcdir=source
5
6SMBCFLAGS = $(EXTRACFLAGS) -Os -ffunction-sections -fdata-sections
7SMBLDFLAGS = -ffunction-sections -fdata-sections -Wl,--gc-sections
8
9ifeq ($(RTCONFIG_BCMARM), y)
10SMBLDFLAGS += -lgcc_s
11endif
12
13ifneq ($(CONFIG_LINUX26),y)
14SMBCFLAGS += -DMAX_DEBUG_LEVEL="-1"
15endif
16
17ifeq ($(RTCONFIG_RECVFILE), y)
18BCMCFLAGS += -DHAVE_BCM_RECVFILE
19endif
20
21ifeq ($(RTCONFIG_BCMARM), y)
22HOST = arm
23else
24HOST = mips
25endif
26
27all: .conf apps
28
29apps: .conf
30	mkdir -p $(srcdir)/bin
31	$(MAKE) -C $(srcdir) CFLAGS+=$(BCMCFLAGS) all
32
33.conf:
34	cd $(srcdir) && \
35	 export SMB_BUILD_CC_NEGATIVE_ENUM_VALUES=yes ; \
36	 export libreplace_cv_READDIR_GETDIRENTRIES=no ; \
37	 export libreplace_cv_READDIR_GETDENTS=no ; \
38	 export linux_getgrouplist_ok=no ; \
39	 export samba_cv_REPLACE_READDIR=no ; \
40	 export samba_cv_HAVE_WRFILE_KEYTAB=yes ; \
41	 export samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes ; \
42	 export samba_cv_HAVE_KERNEL_CHANGE_NOTIF=yes ; \
43	 export samba_cv_HAVE_KERNEL_SHARE_MODES=yes ; \
44	 export samba_cv_HAVE_IFACE_IFCONF=yes ; \
45	 export samba_cv_USE_SETRESUID=yes ; \
46	$(CONFIGURE) \
47		--prefix=/usr \
48		--bindir=/usr/bin \
49		--sbindir=/usr/sbin \
50		--libdir=/etc \
51		--localstatedir=/var \
52		--host=$(HOST)-linux \
53		--with-configdir=/etc \
54		--with-rootsbindir=/usr/sbin \
55		--with-piddir=/var/run/samba \
56		--with-privatedir=/etc/samba \
57		--with-lockdir=/var/lock \
58		--with-included-popt=no \
59		--with-krb5=no \
60		--with-shared-modules=MODULES \
61		--enable-shared \
62		--disable-static \
63		--disable-cups \
64		--disable-iprint \
65		--disable-pie \
66		--disable-fam \
67		--disable-dmalloc \
68		--disable-krb5developer \
69		--disable-developer \
70		--disable-debug \
71		--without-ads \
72		--without-acl-support \
73		--without-ldap \
74		--without-cifsmount \
75		--without-cifsupcall \
76		--without-cluster-support \
77		--without-utmp \
78		--without-winbind \
79		--without-quotas \
80		--without-sys-quotas
81	touch .conf
82	mkdir -p $(srcdir)/bin
83
84clean:
85	-$(MAKE) -C $(srcdir) distclean
86	@rm -f .conf
87
88distclean: clean
89	@find $(srcdir) -name config.h | xargs rm -f
90	@find $(srcdir) -name Makefile | xargs rm -f
91	@find $(srcdir) -name config.status | xargs rm -f
92	@find $(srcdir) -name config.cache | xargs rm -f
93
94install: all
95	@install -d $(INSTALLDIR)/usr/bin/
96	@install -d $(INSTALLDIR)/usr/sbin/
97	@install -d $(INSTALLDIR)/usr/lib/
98	@install -D $(srcdir)/bin/smbd $(INSTALLDIR)/usr/sbin/smbd
99	@install -D $(srcdir)/bin/nmbd $(INSTALLDIR)/usr/sbin/nmbd
100	@install -D $(srcdir)/bin/smbpasswd $(INSTALLDIR)/usr/bin/smbpasswd
101	# @install -D $(srcdir)/bin/libsmbclient.so $(INSTALLDIR)/usr/lib/libsmbclient.so
102	@install -D $(srcdir)/bin/libbigballofmud.so.0 $(INSTALLDIR)/usr/lib/libbigballofmud.so.0
103ifeq ($(RTCONFIG_BCMARM),y)
104	@cp prebuilt.arm/lib/libresolv.so.0 $(INSTALLDIR)/usr/lib/libresolv.so.0
105else
106	@cp prebuilt/lib/libresolv.so.0 $(INSTALLDIR)/usr/lib/libresolv.so.0
107endif
108###############################Charles Modify##########	
109
110	$(STRIP) -s $(INSTALLDIR)/usr/sbin/smbd
111	$(STRIP) -s $(INSTALLDIR)/usr/sbin/nmbd
112	$(STRIP) -s $(INSTALLDIR)/usr/bin/smbpasswd
113#	$(STRIP) -s $(INSTALLDIR)/usr/lib/libsmbclient.so
114	# do not strip shared library, it will be optimized by libfoo.pl
115	# $(STRIP) -s $(INSTALLDIR)/usr/lib/libbigballofmud.so
116