1 # Makefile.internal.in for building the libsmbclient examples
2 # from within a samba build.
4 # Use Makfile for building the examples with a libsmbclient
5 # installed to /usr/local/samba
9 SAMBA_DIR = ../../source3
10 SAMBA_INCLUDES = -I$(SAMBA_DIR)/include
11 SAMBA_LIBPATH = -L$(SAMBA_DIR)/bin
13 GTK_CFLAGS = `gtk-config --cflags`
14 GTK_LIBS = `gtk-config --libs`
16 #GTK_CFLAGS = `pkg-config gtk+-2.0 --cflags`
17 #GTK_LIBS = `pkg-config gtk+-2.0 --libs`
19 CCFLAGS = @CPPFLAGS@ @CFLAGS@ $(GTK_CFLAGS) $(SAMBA_INCLUDES)
22 LDFLAGS= $(SAMBA_LIBPATH) @PIE_LDFLAGS@ @LDFLAGS@
24 EXTERNAL_LIBS = @LIBS@ @LDAP_LIBS@ @KRB5_LIBS@ @NSCD_LIBS@
25 LIBSMBCLIENT_LIBS = -lwbclient -lsmbclient -ltalloc -ltdb -ldl -lresolv
26 CMDLINE_LIBS = @POPTLIBS@
27 LIBS = $(EXTERNAL_LIBS) $(LIBSMBCLIENT_LIBS)
29 # Compile a source file. (.c --> .o)
30 COMPILE_CC = $(CC) -I. $(CCFLAGS) $(PICFLAG) -c $< -o $@
31 COMPILE = $(COMPILE_CC)
33 MAKEDIR = || exec false; \
34 if test -d "$$dir"; then :; else \
36 mkdir -p "$$dir" >/dev/null 2>&1 || \
39 exec false; fi || exec false
61 @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
62 dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
64 @$(COMPILE) && exit 0;\
65 echo "The following command failed:" 1>&2;\
66 echo "$(COMPILE_CC)" 1>&2;\
67 $(COMPILE_CC) >/dev/null 2>&1
70 @echo Linking testsmbc
71 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
75 @$(CC) $(GTK_CFLAGS) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(GTK_LIBS) $(LIBS)
79 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
82 @echo Linking testacl2
83 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
86 @echo Linking testacl3
87 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
89 testbrowse: testbrowse.o
90 @echo Linking testbrowse
91 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
93 testbrowse2: testbrowse2.o
94 @echo Linking testbrowse2
95 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
98 @echo Linking teststat
99 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
101 teststat2: teststat2.o
102 @echo Linking teststat2
103 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
105 teststat3: teststat3.o
106 @echo Linking teststat3
107 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
109 testtruncate: testtruncate.o
110 @echo Linking testtruncate
111 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
113 testchmod: testchmod.o
114 @echo Linking testchmod
115 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
117 testutime: testutime.o
118 @echo Linking testutime
119 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
122 @echo Linking testread
123 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
125 testwrite: testwrite.o
126 @echo Linking testwrite
127 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
130 @echo Linking testctx
131 @$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CMDLINE_LIBS)
137 @rm -f *.o *~ $(TESTS)
138 @make -C smbwrapper clean