removed my badly-done attempt at handling compilers that don't handle
[samba.git] / source3 / Makefile.in
index 3df658a5d63de864d7610825e18b1ba96d3e5c7d..43aecf2dc61e56151abb7d494ac3adc6ab81cb76 100644 (file)
@@ -12,17 +12,16 @@ INSTALL_MAN=$(prefix)/man
 LIBS=@LIBS@
 CC=@CC@
 CFLAGS=@CFLAGS@
+LDFLAGS=@LDFLAGS@
 AWK=@AWK@
 
 INSTALLCMD=@INSTALL@
 
 VPATH=@srcdir@
 srcdir=@srcdir@
+builddir=@builddir@
 SHELL=/bin/sh
 
-.SUFFIXES:
-.SUFFIXES: .c .o
-
 BASEDIR=$(prefix)/samba
 BINDIR = $(BASEDIR)/bin
 SBINDIR = $(BASEDIR)/bin
@@ -65,17 +64,18 @@ SMBRUN = $(BINDIR)/smbrun
 
 
 PASSWD_FLAGS = -DSMB_PASSWD=\"$(SMB_PASSWD)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\"
-FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -DSMBLOGFILE=\"$(SMBLOGFILE)\" -DNMBLOGFILE=\"$(NMBLOGFILE)\"
+FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper -DSMBLOGFILE=\"$(SMBLOGFILE)\" -DNMBLOGFILE=\"$(NMBLOGFILE)\"
 FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"  
 FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DSMBRUN=\"$(SMBRUN)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\"
-FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\"
+FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DBINDIR=\"$(BINDIR)\"
 FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H
 FLAGS  = $(FLAGS5) $(PASSWD_FLAGS)
 
 SPROGS = bin/smbd bin/nmbd bin/swat
 PROGS1 = bin/smbclient bin/testparm bin/testprns bin/smbrun bin/smbstatus 
-PROGS2 = bin/rpcclient bin/smbpasswd bin/make_smbcodepage
-PROGS = $(PROGS1) $(PROGS2) bin/nmblookup bin/make_printerdef 
+PROGS2 = bin/rpcclient bin/smbpasswd bin/make_smbcodepage bin/smbsh bin/smbwrapper.so @WRAP32@
+MPROGS = @MPROGS@
+PROGS = $(PROGS1) $(PROGS2) $(MPROGS) bin/nmblookup bin/make_printerdef 
 
 SCRIPTS = script/smbtar script/addtosmbpass
 
@@ -89,7 +89,7 @@ LIB_OBJ = lib/charcnv.o lib/charset.o lib/debug.o lib/fault.o \
           lib/membuffer.o lib/netmask.o lib/pidfile.o lib/replace.o \
           lib/signal.o lib/slprintf.o lib/system.o lib/time.o lib/ufc.o \
           lib/util.o lib/genrand.o lib/username.o lib/access.o lib/smbrun.o \
-         lib/bitmap.o 
+         lib/bitmap.o lib/crc32.o
 
 UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \
             ubiqx/ubi_dLinkList.o ubiqx/ubi_sLinkList.o
@@ -112,9 +112,15 @@ RPC_PARSE_OBJ = rpc_parse/parse_lsa.o rpc_parse/parse_misc.o \
                 rpc_parse/parse_samr.o rpc_parse/parse_srv.o \
                 rpc_parse/parse_wks.o
 
-RPC_CLIENT_OBJ = rpc_client/cli_login.o rpc_client/cli_netlogon.o \
-                 rpc_client/cli_pipe.o rpc_client/cli_lsarpc.o \
-                 rpc_client/cli_wkssvc.o rpc_client/cli_samr.o
+RPC_CLIENT_OBJ = \
+               rpc_client/cli_login.o    \
+               rpc_client/cli_netlogon.o \
+               rpc_client/cli_pipe.o     \
+               rpc_client/cli_lsarpc.o   \
+               rpc_client/cli_wkssvc.o   \
+               rpc_client/cli_srvsvc.o   \
+               rpc_client/cli_samr.o 
+
 
 LOCKING_OBJ = locking/locking.o locking/locking_shm.o locking/locking_slow.o \
               locking/shmem.o locking/shmem_sysv.o
@@ -160,6 +166,9 @@ SWAT_OBJ = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
 
 SMBRUN_OBJ = utils/smbrun.o
 
+SMBSH_OBJ = smbwrapper/smbsh.o smbwrapper/shared.o \
+            $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
+
 MAKE_SMBCODEPAGE_OBJ = utils/make_smbcodepage.o $(PARAM_OBJ) \
                        $(UBIQX_OBJ) $(LIB_OBJ)
 
@@ -183,21 +192,40 @@ RPCCLIENT_OBJ = rpcclient/rpcclient.o \
              rpcclient/cmd_lsarpc.o \
              rpcclient/cmd_wkssvc.o \
              rpcclient/cmd_samr.o \
+             rpcclient/cmd_srvsvc.o \
+             rpcclient/cmd_netlogon.o \
              $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
              $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ)
-#             rpcclient/cmd_netlogon.o \
-#             rpcclient/cmd_srvsvc.o \
+
+SMBWRAPPER_OBJ = smbwrapper/smbw.o smbwrapper/wrapped.o \
+               smbwrapper/smbw_dir.o smbwrapper/smbw_stat.o \
+               smbwrapper/realcalls.o smbwrapper/shared.o \
+               $(LIBSMB_OBJ) $(PARAM_OBJ) \
+                $(UBIQX_OBJ) $(LIB_OBJ)
 
 CLIENT_OBJ = client/client.o client/clientutil.o client/clitar.o \
              $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
 
+MOUNT_OBJ = client/smbmount.o client/clientutil.o \
+             $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
+
+MNT_OBJ = client/smbmnt.o \
+             $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
+
+UMOUNT_OBJ = client/smbumount.o \
+             $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
+
 NMBLOOKUP_OBJ = utils/nmblookup.o $(PARAM_OBJ) $(UBIQX_OBJ) \
                 $(LIBSMB_OBJ) $(LIB_OBJ)
 
 SMBTORTURE_OBJ = utils/torture.o $(LIBSMB_OBJ) $(PARAM_OBJ) \
                  $(UBIQX_OBJ) $(LIB_OBJ)
 
-PROTO_OBJ = $(SMBD_OBJ) $(NMBD_OBJ) $(SWAT_OBJ) $(CLIENT_OBJ) $(RPCCLIENT_OBJ)
+PROTO_OBJ = $(SMBD_OBJ) $(NMBD_OBJ) $(SWAT_OBJ) $(CLIENT_OBJ) \
+           $(RPCCLIENT_OBJ) $(SMBWRAPPER_OBJ)
+
+PICOBJS = $(SMBWRAPPER_OBJ:.o=.po)
+PICOBJS32 = $(SMBWRAPPER_OBJ:.o=.po32)
 
 ######################################################################
 # now the rules...
@@ -205,76 +233,134 @@ PROTO_OBJ = $(SMBD_OBJ) $(NMBD_OBJ) $(SWAT_OBJ) $(CLIENT_OBJ) $(RPCCLIENT_OBJ)
 
 all : CHECK $(SPROGS) $(PROGS) 
 
+smbwrapper : CHECK bin/smbsh bin/smbwrapper.so @WRAP32@
+
+smbtorture : CHECK bin/smbtorture
+
 .SUFFIXES:
-.SUFFIXES: .c .o .h
+.SUFFIXES: .c .o .po .po32
 
 CHECK:
        @echo "Using FLAGS = $(FLAGS)"
        @echo "Using LIBS = $(LIBS)"
 
+MAKEDIR = || exec false; \
+         if test -d "$$dir"; then :; else \
+         echo mkdir "$$dir"; \
+         mkdir -p "$$dir" >/dev/null 2>&1 || \
+         test -d "$$dir" || \
+         mkdir "$$dir" || \
+         exec false; fi || exec false
+
 .c.o: @MAINT@ .deps/.dummy
+       @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
+        dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
        @echo Compiling $*.c
        @$(CC) -I. -I$(srcdir) $(FLAGS) -c $< -o $@ \
        @MAINT@ -Wp,-MD,.deps/`echo $* | sed s,/,_,g`.P && : >.deps/.stamp
 # the line above is for atomatic dependency tracking
 # it will only work with GNU make, gcc and --enable-maintainer-mode
 
-bin/smbd: $(SMBD_OBJ) 
+
+.c.po: @MAINT@ .deps/.dummy
+       @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
+         dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+       @echo Compiling $*.c with @PICFLAG@
+       @$(CC) -I. -I$(srcdir) $(FLAGS) @PICFLAG@ -c $< -o $@ \
+       @MAINT@ -Wp,-MD,.deps/`echo $* | sed s,/,_,g`.P && : >.deps/.stamp
+
+# this is for IRIX
+.c.po32: @MAINT@ .deps/.dummy
+       @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
+         dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+       @echo Compiling $*.c with @PICFLAG@ and -32
+       @$(CC) -32 -I. -I$(srcdir) $(FLAGS) @PICFLAG@ -c $< -o $@ \
+       @MAINT@ -Wp,-MD,.deps/`echo $* | sed s,/,_,g`.P && : >.deps/.stamp
+
+bin/.dummy:
+       @if (: >> $@ || : > $@) >/dev/null 2>&1; then :; else \
+         dir=bin $(MAKEDIR); fi
+       @: >> $@ || : > $@ # what a fancy emoticon!
+
+bin/smbd: $(SMBD_OBJ) bin/.dummy
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LIBS) 
+
+bin/nmbd: $(NMBD_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LIBS) 
+       @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/nmbd: $(NMBD_OBJ)
+bin/swat: $(SWAT_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(LIBS) 
 
-bin/swat: $(SWAT_OBJ)
+bin/smbrun: $(SMBRUN_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LIBS) 
+       @$(CC) $(FLAGS) -o $@ $(SMBRUN_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbrun: $(SMBRUN_OBJ)
+bin/rpcclient: $(RPCCLIENT_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(SMBRUN_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/rpcclient: $(RPCCLIENT_OBJ) 
+bin/smbclient: $(CLIENT_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbclient: $(CLIENT_OBJ) 
+bin/smbmount: $(MOUNT_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(MOUNT_OBJ) $(LIBS)
 
-bin/testparm: $(TESTPARM_OBJ)
+bin/smbmnt: $(MNT_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(TESTPARM_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(MNT_OBJ) $(LIBS)
 
-bin/testprns: $(TESTPRNS_OBJ)
+bin/smbumount: $(UMOUNT_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(TESTPRNS_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(UMOUNT_OBJ) $(LIBS)
 
-bin/smbstatus: $(STATUS_OBJ)
+bin/testparm: $(TESTPARM_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(STATUS_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(TESTPARM_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbpasswd: $(SMBPASSWD_OBJ)
+bin/testprns: $(TESTPRNS_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(TESTPRNS_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/make_smbcodepage: $(MAKE_SMBCODEPAGE_OBJ) 
+bin/smbstatus: $(STATUS_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(MAKE_SMBCODEPAGE_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(STATUS_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/nmblookup: $(NMBLOOKUP_OBJ)
+bin/smbpasswd: $(SMBPASSWD_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(NMBLOOKUP_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/make_printerdef: $(MAKE_PRINTERDEF_OBJ) 
+bin/make_smbcodepage: $(MAKE_SMBCODEPAGE_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(MAKE_PRINTERDEF_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(MAKE_SMBCODEPAGE_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbtorture: $(SMBTORTURE_OBJ) 
+bin/nmblookup: $(NMBLOOKUP_OBJ) bin/.dummy
        @echo Linking $@
-       @$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJ) $(LIBS)
+       @$(CC) $(FLAGS) -o $@ $(NMBLOOKUP_OBJ) $(LDFLAGS) $(LIBS)
 
+bin/make_printerdef: $(MAKE_PRINTERDEF_OBJ) bin/.dummy
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(MAKE_PRINTERDEF_OBJ) $(LDFLAGS) $(LIBS)
+
+bin/smbtorture: $(SMBTORTURE_OBJ) bin/.dummy
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJ) $(LDFLAGS) $(LIBS)
+
+bin/smbwrapper.so: $(PICOBJS)
+       @echo Linking shared library $@
+       @$(LD) @LDSHFLAGS@ -o $@ $(PICOBJS) $(LIBS)
+
+bin/smbwrapper.32.so: $(PICOBJS32)
+       @echo Linking shared library $@
+       @$(LD) -32 @LDSHFLAGS@ -o $@ $(PICOBJS32) $(LIBS)
+
+bin/smbsh: $(SMBSH_OBJ) bin/.dummy
+       @echo Linking $@
+       @$(CC) $(FLAGS) -o $@ $(SMBSH_OBJ) $(LDFLAGS) $(LIBS)
 
 install: installbin installman installscripts installcp installswat
 
@@ -319,11 +405,11 @@ uninstallcp:
        @$(SHELL) $(srcdir)/script/uninstallcp.sh $(CODEPAGEDIR) $(CODEPAGELIST)
 
 clean: 
-       -rm -f core */*~ *~ */*.o
+       -rm -f core */*~ *~ */*.o */*.po */*.po32 */*.so
 
-proto:
+proto: 
        @echo rebuilding include/proto.h
-       @cd $(srcdir) && $(AWK) -f script/mkproto.awk `echo $(PROTO_OBJ) | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort -u | grep -v "ubiqx/"` > include/proto.h
+       @cd $(srcdir) && $(AWK) -f script/mkproto.awk `echo $(PROTO_OBJ) | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort -u | egrep -v 'ubiqx/|wrapped'` > include/proto.h
 
 etags:
        etags `find . -name "*.[ch]"`
@@ -332,10 +418,11 @@ ctags:
        ctags `find . -name "*.[ch]"`
 
 realclean: clean
-       -rm -f config.log $(PROGS) $(SPROGS)
+       -rm -f config.log $(PROGS) $(SPROGS) bin/.dummy
+       -rmdir bin
 
 distclean: realclean
-       -rm -f include/config.h include/stamp-h */dummy Makefile
+       -rm -f include/config.h include/stamp-h Makefile
        -rm -f config.status config.cache
        -rm -rf .deps
 
@@ -358,7 +445,8 @@ $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/aclocal.m4
 config.status: $(srcdir)/configure
        $(SHELL) ./config.status --recheck
 
-Makefile: $(srcdir)/Makefile.in config.status
+Makefile: $(srcdir)/Makefile.in config.status \
+         include/stamp-h # just to ensure that config.h is up-to-date
        CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
 # note that nothing depends on config.h, so will probably be rebuilt
@@ -375,17 +463,18 @@ $(srcdir)/include/config.h.in: $(srcdir)/include/stamp-h.in
 
 $(srcdir)/include/stamp-h.in: @MAINT@ $(srcdir)/acconfig.h $(srcdir)/configure.in
        cd $(srcdir) && $(AUTOHEADER)
-       @cd $(srcdir) && echo > include/stamp-h.in
+       @date -u > $@
 
 # automatic dependency tracking rules
 .deps/.dummy:
-       @-if test ! -d .deps; then rm -rf .deps; mkdir .deps; fi
-       @: >$@
+       @if (: >> $@ || : > $@) >/dev/null 2>&1; then :; else \
+         dir=.deps $(MAKEDIR); fi
+       @: >> $@ || : > $@ # what a fancy emoticon!
 
 .deps/.stamp: .deps/.dummy
        @:
 
 .deps/.P: .deps/.stamp
-       @-cat .deps/*.P >$@ 2>/dev/null
+       @cat .deps/*.P >$@ 2>/dev/null || true
 
 @MAINT@-include .deps/.P