More fixes for builddir != srcdir.
authorTim Potter <tpot@samba.org>
Tue, 27 May 2003 02:35:53 +0000 (02:35 +0000)
committerTim Potter <tpot@samba.org>
Tue, 27 May 2003 02:35:53 +0000 (02:35 +0000)
 - Use absolute directories for $builddir and $srcdir in the Makefile

 - Don't try and combine source files in $builddir and $srcdir to build
   proto.h.  It's just too hard to get it right across all targets we
   wish to compile on.  Use a hand created prototype for the single
   function in smbd/build_options.c that we need.  This allows us to ditch
   all the extra sed work that was causing problems: \t not portable - hah!

 - Fix bogus delheaders target to remove the correct files

This appears to work quite nicely now.  Let's see how it goes on the
buildfarm machines.

source/Makefile.in
source/configure.in
source/script/.cvsignore
source/script/mkproto.sh [moved from source/script/mkproto.sh.in with 73% similarity]
source/smbd/server.c

index f1637610599bfc90672fc8eaeec258222a41fab9..536d45bd1f87cd4ff3811d76dc445446683ebce1 100644 (file)
@@ -41,8 +41,8 @@ INSTALLCLIENTCMD_SH=@INSTALLCLIENTCMD_SH@
 INSTALLCLIENTCMD_A=@INSTALLCLIENTCMD_A@
 
 VPATH=@srcdir@
-srcdir=@srcdir@
-builddir=@builddir@
+srcdir=@abs_srcdir@
+builddir=@abs_builddir@
 SHELL=/bin/sh
 
 # XXX: Perhaps this should be @SHELL@ instead -- apparently autoconf
@@ -1239,25 +1239,18 @@ proto_exists: include/proto.h include/wrepld_proto.h include/build_env.h \
 
 delheaders:
        @echo Removing prototype headers
-       @/bin/rm -f $(srcdir)/include/proto.h $(srcdir)/include/build_env.h 
-       @/bin/rm -f $(srcdir)/include/wrepld_proto.h $(srcdir)/nsswitch/winbindd_proto.h 
-       @/bin/rm -f $(srcdir)/web/swat_proto.h
-       @/bin/rm -f $(srcdir)/client/client_proto.h $(srcdir)/utils/net_proto.h
-       @/bin/rm -f $(srcdir)/smbd/build_options.c
+       @rm -f include/proto.h include/build_env.h  include/wrepld_proto.h \
+               nsswitch/winbindd_proto.h web/swat_proto.h \
+               client/client_proto.h utils/net_proto.h \
+               smbd/build_options.c
 
-       @/bin/rm -f include/proto.h include/build_env.h include/wrepld_proto.h \
-                   nsswitch/winbindd_proto.h web/swat_proto.h \
-                   client/client_proto.h utils/net_proto.h smbd/build_options.c
-# Location of mkproto.sh
-
-MKPROTO_SH = $(builddir)/script/mkproto.sh
+MKPROTO_SH = $(srcdir)/script/mkproto.sh
 
 include/proto.h: smbd/build_options.c
        @echo Building include/proto.h
-       @$(SHELL) $(MKPROTO_SH) $(AWK) \
+       @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \
          -h _PROTO_H_ $(builddir)/include/proto.h \
-         $(builddir)/smbd/build_options.o \
-         `echo $(PROTO_OBJ) | sed -e 's%\([^ ]* \)%$(srcdir)/\1%g'`
+         $(PROTO_OBJ)
 
 include/build_env.h: script/build_env.sh
        @echo Building include/build_env.h
@@ -1266,29 +1259,29 @@ include/build_env.h: script/build_env.sh
 
 include/wrepld_proto.h:
        @echo Building include/wrepld_proto.h
-       @$(SHELL) $(MKPROTO_SH) $(AWK) \
+       @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \
          -h _WREPLD_PROTO_H_ $(builddir)/include/wrepld_proto.h \
-         `echo $(WREPL_OBJ1) | sed -e 's%\([^ ]* \)%$(srcdir)/\1%g'`
+         $(WREPL_OBJ1)
 
 nsswitch/winbindd_proto.h: 
-       @$(SHELL) $(MKPROTO_SH) $(AWK) \
-         -h _WINBINDD_PROTO_H_ nsswitch/winbindd_proto.h \
-         `echo $(WINBINDD_OBJ1) | sed -e 's%\([^ ]* \)%$(srcdir)/\1%g'`
+       @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \
+         -h _WINBINDD_PROTO_H_ $(builddir)/nsswitch/winbindd_proto.h \
+         $(WINBINDD_OBJ1)
 
 web/swat_proto.h: 
-       @$(SHELL) $(MKPROTO_SH) $(AWK) \
-         -h _SWAT_PROTO_H_ web/swat_proto.h \
-         `echo $(SWAT_OBJ1) | sed -e 's%\([^ ]* \)%$(srcdir)/\1%g'`
+       @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \
+         -h _SWAT_PROTO_H_ $(builddir)/web/swat_proto.h \
+         $(SWAT_OBJ1)
 
 client/client_proto.h: 
-       @$(SHELL) $(MKPROTO_SH) $(AWK) \
-         -h _CLIENT_PROTO_H_ client/client_proto.h \
-         `echo $(CLIENT_OBJ1) | sed -e 's%\([^ ]* \)%$(srcdir)/\1%g'`
+       @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \
+         -h _CLIENT_PROTO_H_ $(builddir)/client/client_proto.h \
+         $(CLIENT_OBJ1)
 
 utils/net_proto.h: 
-       @$(SHELL) $(MKPROTO_SH) $(AWK) \
-         -h _CLIENT_PROTO_H_ utils/net_proto.h \
-         `echo $(NET_OBJ1) | sed -e 's%\([^ ]* \)%$(srcdir)/\1%g'`
+       @cd $(srcdir) && $(SHELL) $(MKPROTO_SH) $(AWK) \
+         -h _CLIENT_PROTO_H_ $(builddir)/utils/net_proto.h \
+         $(NET_OBJ1)
 
 # "make headers" or "make proto" calls a subshell because we need to
 # make sure these commands are executed in sequence even for a
index ccc7148c6eec43518fb136aff854d056f785a273..ebe0d44192bf1b61cf8773b66dea0a89a9919d2d 100644 (file)
@@ -3797,7 +3797,7 @@ dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS
 CFLAGS_REMOVE_USR_INCLUDE(CFLAGS)
 CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS)
 
-AC_OUTPUT(include/stamp-h Makefile script/findsmb script/mkproto.sh)
+AC_OUTPUT(include/stamp-h Makefile script/findsmb)
 
 #################################################
 # Print very concise instructions on building/use
index 5efd0d33db3b73c17e53411070f972d9db161687..7a8114ecd73942c7d16348b6bbca42705c4e9b91 100644 (file)
@@ -1,2 +1 @@
 findsmb
-mkproto.sh
similarity index 73%
rename from source/script/mkproto.sh.in
rename to source/script/mkproto.sh
index 8d7d300ff5df20c54c4f3ebafebf9a8d50dc80ff..2bf96c9b41de714e761b13851a6e15aa09f03263 100755 (executable)
@@ -1,13 +1,9 @@
-#! /bin/sh -x
+#! /bin/sh
 
 LANG=C; export LANG
 LC_ALL=C; export LC_ALL
 LC_COLLATE=C; export LC_COLLATE
 
-# Need reference point for "mkproto.awk", including when "srcdir != builddir".
-# Use of "abs_..." is unpleasant.  Is there another way?
-abs_srcdir=@abs_srcdir@
-
 if [ $# -lt 3 ]
 then
   echo "Usage: $0 awk [-h headerdefine] outputheader proto_obj"
@@ -36,7 +32,7 @@ echo creating $header
 mkdir -p `dirname $header`
 
 ${awk} $headeropt \
-  -f $abs_srcdir/mkproto.awk $proto_src > $headertmp
+  -f script/mkproto.awk $proto_src > $headertmp
 
 if cmp -s $header $headertmp 2>/dev/null
 then
index edc7b57ba3988f32c84fc2fe2dc3648af00ae488..07723cc20e7e7284189c4d936b460cb058bacf9a 100644 (file)
@@ -634,6 +634,12 @@ static BOOL init_structs(void )
  main program.
 ****************************************************************************/
 
+/* Declare prototype for build_options() to avoid having to run it through
+   mkproto.h.  Mixing $(builddir) and $(srcdir) source files in the current
+   prototype generation system is too complicated. */
+
+void build_options(BOOL screen);
+
  int main(int argc,const char *argv[])
 {
        /* shall I run as a daemon */