summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/appweb/config.mk6
-rw-r--r--source4/lib/basic.mk34
-rw-r--r--source4/lib/charset/config.mk7
-rw-r--r--source4/lib/cmdline/config.mk14
-rw-r--r--source4/lib/crypto/config.mk6
-rw-r--r--source4/lib/dbwrap/config.mk2
-rw-r--r--source4/lib/events/config.mk14
-rw-r--r--source4/lib/ldb-samba/config.mk4
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py2
-rw-r--r--source4/lib/messaging/config.mk3
-rw-r--r--source4/lib/messaging/messaging.c6
-rw-r--r--source4/lib/nss_wrapper/config.mk2
-rw-r--r--source4/lib/registry/config.mk48
-rw-r--r--source4/lib/samba3/config.mk5
-rw-r--r--source4/lib/socket/config.mk11
-rw-r--r--source4/lib/socket_wrapper/config.mk2
-rw-r--r--source4/lib/stream/config.mk2
-rw-r--r--source4/lib/tdr/config.mk7
-rw-r--r--source4/lib/tls/config.mk2
-rw-r--r--source4/lib/torture/config.mk6
-rw-r--r--source4/lib/util/config.mk23
21 files changed, 102 insertions, 104 deletions
diff --git a/source4/lib/appweb/config.mk b/source4/lib/appweb/config.mk
index c0bba35ba5..4d27b69fb5 100644
--- a/source4/lib/appweb/config.mk
+++ b/source4/lib/appweb/config.mk
@@ -4,7 +4,7 @@
# End SUBSYSTEM MPR
#######################
-MPR_OBJ_FILES = $(addprefix lib/appweb/mpr/, miniMpr.o var.o)
+MPR_OBJ_FILES = $(addprefix $(appwebsrcdir)/mpr/, miniMpr.o var.o)
#######################
# Start SUBSYSTEM EJS
@@ -13,7 +13,7 @@ PUBLIC_DEPENDENCIES = MPR
# End SUBSYSTEM EJS
#######################
-EJS_OBJ_FILES = $(addprefix lib/appweb/ejs/, ejsLib.o ejsLex.o ejsParser.o ejsProcs.o)
+EJS_OBJ_FILES = $(addprefix $(appwebsrcdir)/ejs/, ejsLib.o ejsLex.o ejsParser.o ejsProcs.o)
#######################
# Start SUBSYSTEM ESP
@@ -22,4 +22,4 @@ PUBLIC_DEPENDENCIES = EJS
# End SUBSYSTEM ESP
#######################
-ESP_OBJ_FILES = $(addprefix lib/appweb/esp/, esp.o espProcs.o)
+ESP_OBJ_FILES = $(addprefix $(appwebsrcdir)/esp/, esp.o espProcs.o)
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index e7e0ba80c4..b86df5dc9f 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -1,45 +1,25 @@
-# LIB BASIC subsystem
-mkinclude samba3/config.mk
-mkinclude socket/config.mk
-mkinclude charset/config.mk
-mkinclude ldb-samba/config.mk
-mkinclude tls/config.mk
-mkinclude registry/config.mk
-mkinclude messaging/config.mk
-mkinclude events/config.mk
-mkinclude cmdline/config.mk
-mkinclude socket_wrapper/config.mk
-mkinclude nss_wrapper/config.mk
-mkinclude appweb/config.mk
-mkinclude stream/config.mk
-mkinclude util/config.mk
-mkinclude tdr/config.mk
-mkinclude dbwrap/config.mk
-mkinclude crypto/config.mk
-mkinclude torture/config.mk
-
[SUBSYSTEM::LIBCOMPRESSION]
-LIBCOMPRESSION_OBJ_FILES = lib/compression/mszip.o
+LIBCOMPRESSION_OBJ_FILES = $(libcompressionsrcdir)/mszip.o
[SUBSYSTEM::GENCACHE]
PRIVATE_DEPENDENCIES = TDB_WRAP
-GENCACHE_OBJ_FILES = gencache/gencache.o
+GENCACHE_OBJ_FILES = $(libgencachesrcdir)/gencache.o
-# PUBLIC_HEADERS += lib/gencache/gencache.h
+# PUBLIC_HEADERS += $(libgencachesrcdir)/gencache.h
[SUBSYSTEM::LDB_WRAP]
PUBLIC_DEPENDENCIES = LIBLDB
PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB
-LDB_WRAP_OBJ_FILES = lib/ldb_wrap.o
-PUBLIC_HEADERS += lib/ldb_wrap.h
+LDB_WRAP_OBJ_FILES = $(libsrcdir)/ldb_wrap.o
+PUBLIC_HEADERS += $(libsrcdir)/ldb_wrap.h
[SUBSYSTEM::TDB_WRAP]
PUBLIC_DEPENDENCIES = LIBTDB
-TDB_WRAP_OBJ_FILES = lib/tdb_wrap.o
-PUBLIC_HEADERS += lib/tdb_wrap.h
+TDB_WRAP_OBJ_FILES = $(libsrcdir)/tdb_wrap.o
+PUBLIC_HEADERS += $(libsrcdir)/tdb_wrap.h
SMBREADLINE_OBJ_LIST = $(SMBREADLINE_OBJ_FILES)
diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk
index e5e5bd4560..12c2f5f321 100644
--- a/source4/lib/charset/config.mk
+++ b/source4/lib/charset/config.mk
@@ -1,12 +1,13 @@
################################################
# Start SUBSYSTEM CHARSET
[SUBSYSTEM::CHARSET]
-PRIVATE_PROTO_HEADER = charset_proto.h
PUBLIC_DEPENDENCIES = ICONV
PRIVATE_DEPENDENCIES = DYNCONFIG
# End SUBSYSTEM CHARSET
################################################
-CHARSET_OBJ_FILES = $(addprefix lib/charset/, iconv.o charcnv.o util_unistr.o)
+CHARSET_OBJ_FILES = $(addprefix $(libcharsetsrcdir)/, iconv.o charcnv.o util_unistr.o)
-PUBLIC_HEADERS += lib/charset/charset.h
+PUBLIC_HEADERS += $(libcharsetsrcdir)/charset.h
+
+$(eval $(call proto_header_template,$(libcharsetsrcdir)/charset_proto.h,$(CHARSET_OBJ_FILES:.o=.c)))
diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk
index f8a971a063..4434ff3701 100644
--- a/source4/lib/cmdline/config.mk
+++ b/source4/lib/cmdline/config.mk
@@ -1,19 +1,21 @@
[SUBSYSTEM::LIBCMDLINE_CREDENTIALS]
-PRIVATE_PROTO_HEADER = credentials.h
PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT
-LIBCMDLINE_CREDENTIALS_OBJ_FILES = lib/cmdline/credentials.o
+LIBCMDLINE_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/credentials.o
+
+$(eval $(call proto_header_template,$(libcmdlinesrcdir)/credentials.h,$(LIBCMDLINE_CREDENTIALS_OBJ_FILES:.o=.c)))
[SUBSYSTEM::POPT_SAMBA]
PUBLIC_DEPENDENCIES = LIBPOPT
-POPT_SAMBA_OBJ_FILES = lib/cmdline/popt_common.o
+POPT_SAMBA_OBJ_FILES = $(libcmdlinesrcdir)/popt_common.o
-PUBLIC_HEADERS += lib/cmdline/popt_common.h
+PUBLIC_HEADERS += $(libcmdlinesrcdir)/popt_common.h
[SUBSYSTEM::POPT_CREDENTIALS]
-PRIVATE_PROTO_HEADER = popt_credentials.h
PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS LIBPOPT
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL
-POPT_CREDENTIALS_OBJ_FILES = lib/cmdline/popt_credentials.o
+POPT_CREDENTIALS_OBJ_FILES = $(libcmdlinesrcdir)/popt_credentials.o
+
+$(eval $(call proto_header_template,$(libcmdlinesrcdir)/popt_credentials.h,$(POPT_CREDENTIALS_OBJ_FILES:.o=.c)))
diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk
index 8e0cba17f0..b9a7f7cb9e 100644
--- a/source4/lib/crypto/config.mk
+++ b/source4/lib/crypto/config.mk
@@ -4,7 +4,7 @@
# End SUBSYSTEM LIBCRYPTO
##############################
-LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \
+LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \
crc32.o md5.o hmacmd5.o md4.o \
arcfour.o sha1.o hmacsha1.o)
@@ -12,8 +12,8 @@ LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \
[MODULE::TORTURE_LIBCRYPTO]
SUBSYSTEM = smbtorture
PRIVATE_DEPENDENCIES = LIBCRYPTO
-PRIVATE_PROTO_HEADER = test_proto.h
-TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \
+TORTURE_LIBCRYPTO_OBJ_FILES = $(addprefix $(libcryptosrcdir)/, \
md4test.o md5test.o hmacmd5test.o sha1test.o hmacsha1test.o)
+$(eval $(call proto_header_template,$(libcryptosrcdir)/test_proto.h,$(TORTURE_LIBCRYPTO_OBJ_FILES:.o=.c)))
diff --git a/source4/lib/dbwrap/config.mk b/source4/lib/dbwrap/config.mk
index 9038873d32..34e2629b16 100644
--- a/source4/lib/dbwrap/config.mk
+++ b/source4/lib/dbwrap/config.mk
@@ -2,5 +2,5 @@
PUBLIC_DEPENDENCIES = \
LIBTDB ctdb
-LIBDBWRAP_OBJ_FILES = $(addprefix lib/dbwrap/, dbwrap.o dbwrap_tdb.o dbwrap_ctdb.o)
+LIBDBWRAP_OBJ_FILES = $(addprefix $(libdbwrapsrcdir)/, dbwrap.o dbwrap_tdb.o dbwrap_ctdb.o)
diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk
index 34c24f76f5..3a20770427 100644
--- a/source4/lib/events/config.mk
+++ b/source4/lib/events/config.mk
@@ -15,7 +15,7 @@ SUBSYSTEM = LIBEVENTS
INIT_FUNCTION = s4_events_aio_init
##############################
-EVENTS_AIO_OBJ_FILES = lib/events/events_aio.o
+EVENTS_AIO_OBJ_FILES = $(libeventssrcdir)/events_aio.o
##############################
[MODULE::EVENTS_EPOLL]
@@ -23,7 +23,7 @@ SUBSYSTEM = LIBEVENTS
INIT_FUNCTION = s4_events_epoll_init
##############################
-EVENTS_EPOLL_OBJ_FILES = lib/events/events_epoll.o
+EVENTS_EPOLL_OBJ_FILES = $(libeventssrcdir)/events_epoll.o
##############################
[MODULE::EVENTS_SELECT]
@@ -31,7 +31,7 @@ SUBSYSTEM = LIBEVENTS
INIT_FUNCTION = s4_events_select_init
##############################
-EVENTS_SELECT_OBJ_FILES = lib/events/events_select.o
+EVENTS_SELECT_OBJ_FILES = $(libeventssrcdir)/events_select.o
##############################
[MODULE::EVENTS_STANDARD]
@@ -39,7 +39,7 @@ SUBSYSTEM = LIBEVENTS
INIT_FUNCTION = s4_events_standard_init
##############################
-EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o
+EVENTS_STANDARD_OBJ_FILES = $(libeventssrcdir)/events_standard.o
##############################
# Start SUBSYSTEM LIBEVENTS
@@ -47,12 +47,12 @@ EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o
# End SUBSYSTEM LIBEVENTS
##############################
-LIBEVENTS_OBJ_FILES = $(addprefix lib/events/, events.o events_timed.o events_signal.o)
+LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, events.o events_timed.o events_signal.o)
-PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h)
+PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h)
[PYTHON::swig_events]
SWIG_FILE = events.i
PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG
-swig_events_OBJ_FILES = lib/events/events_wrap.o
+swig_events_OBJ_FILES = $(libeventssrcdir)/events_wrap.o
diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk
index 6a0b842fff..84007f3833 100644
--- a/source4/lib/ldb-samba/config.mk
+++ b/source4/lib/ldb-samba/config.mk
@@ -2,10 +2,10 @@
# Start SUBSYSTEM LDBSAMBA
[SUBSYSTEM::LDBSAMBA]
PUBLIC_DEPENDENCIES = LIBLDB
-PRIVATE_PROTO_HEADER = ldif_handlers.h
PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC
# End SUBSYSTEM LDBSAMBA
################################################
-LDBSAMBA_OBJ_FILES = lib/ldb-samba/ldif_handlers.o
+LDBSAMBA_OBJ_FILES = $(ldb_sambasrcdir)/ldif_handlers.o
+$(eval $(call proto_header_template,$(ldb_sambasrcdir)/ldif_handlers.h,$(LDBSAMBA_OBJ_FILES:.o=.c)))
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index ead5796b7b..7cbe6e5e7d 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -6,6 +6,8 @@ import getopt
import optparse
import sys
+sys.path.append("bin/python")
+
import samba.getopt as options
from auth import system_session
diff --git a/source4/lib/messaging/config.mk b/source4/lib/messaging/config.mk
index 0a0097bdf3..eaf7e3581e 100644
--- a/source4/lib/messaging/config.mk
+++ b/source4/lib/messaging/config.mk
@@ -13,5 +13,4 @@ PUBLIC_DEPENDENCIES = \
# End SUBSYSTEM MESSAGING
################################################
-
-MESSAGING_OBJ_FILES = lib/messaging/messaging.o
+MESSAGING_OBJ_FILES = $(libmessagingsrcdir)/messaging.o
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 19284461ee..e7b654894f 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -1085,8 +1085,14 @@ void irpc_remove_name(struct messaging_context *msg_ctx, const char *name)
return;
}
rec = tdb_fetch_bystring(t->tdb, name);
+ if (rec.dptr == NULL) {
+ tdb_unlock_bystring(t->tdb, name);
+ talloc_free(t);
+ return;
+ }
count = rec.dsize / sizeof(struct server_id);
if (count == 0) {
+ free(rec.dptr);
tdb_unlock_bystring(t->tdb, name);
talloc_free(t);
return;
diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk
index 5f136a465d..015fbe511c 100644
--- a/source4/lib/nss_wrapper/config.mk
+++ b/source4/lib/nss_wrapper/config.mk
@@ -4,4 +4,4 @@
# End SUBSYSTEM NSS_WRAPPER
##############################
-NSS_WRAPPER_OBJ_FILES = lib/nss_wrapper/nss_wrapper.o
+NSS_WRAPPER_OBJ_FILES = $(nsswrappersrcdir)/nss_wrapper.o
diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk
index ce19d8512e..c0ad613c52 100644
--- a/source4/lib/registry/config.mk
+++ b/source4/lib/registry/config.mk
@@ -1,19 +1,19 @@
[SUBSYSTEM::TDR_REGF]
PUBLIC_DEPENDENCIES = TDR
-TDR_REGF_OBJ_FILES = lib/registry/tdr_regf.o
+TDR_REGF_OBJ_FILES = $(libregistrysrcdir)/tdr_regf.o
# Special support for external builddirs
-lib/registry/regf.c: lib/registry/tdr_regf.c
-$(srcdir)/lib/registry/regf.c: lib/registry/tdr_regf.c
-lib/registry/tdr_regf.h: lib/registry/tdr_regf.c
-lib/registry/tdr_regf.c: $(srcdir)/lib/registry/regf.idl
+$(libregistrysrcdir)/regf.c: $(libregistrysrcdir)/tdr_regf.c
+$(srcdir)/$(libregistrysrcdir)/regf.c: $(libregistrysrcdir)/tdr_regf.c
+$(libregistrysrcdir)/tdr_regf.h: $(libregistrysrcdir)/tdr_regf.c
+$(libregistrysrcdir)/tdr_regf.c: $(srcdir)/$(libregistrysrcdir)/regf.idl
@CPP="$(CPP)" srcdir="$(srcdir)" $(PERL) $(srcdir)/pidl/pidl $(PIDL_ARGS) \
--header --outputdir=lib/registry \
- --tdr-parser -- $(srcdir)/lib/registry/regf.idl
+ --tdr-parser -- $(srcdir)/$(libregistrysrcdir)/regf.idl
clean::
- @-rm -f lib/registry/regf.h lib/registry/tdr_regf*
+ @-rm -f $(libregistrysrcdir)/regf.h $(libregistrysrcdir)/tdr_regf*
################################################
# Start SUBSYSTEM registry
@@ -24,22 +24,23 @@ PUBLIC_DEPENDENCIES = \
# End MODULE registry_ldb
################################################
-PC_FILES += lib/registry/registry.pc
+PC_FILES += $(libregistrysrcdir)/registry.pc
registry_VERSION = 0.0.1
registry_SOVERSION = 0
-registry_OBJ_FILES = $(addprefix lib/registry/, interface.o util.o samba.o \
+registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/, interface.o util.o samba.o \
patchfile_dotreg.o patchfile_preg.o patchfile.o regf.o \
hive.o local.o ldb.o dir.o rpc.o)
-PUBLIC_HEADERS += lib/registry/registry.h
+PUBLIC_HEADERS += $(libregistrysrcdir)/registry.h
[SUBSYSTEM::registry_common]
PUBLIC_DEPENDENCIES = registry
-PRIVATE_PROTO_HEADER = tools/common.h
-registry_common_OBJ_FILES = lib/registry/tools/common.o
+registry_common_OBJ_FILES = $(libregistrysrcdir)/tools/common.o
+
+$(eval $(call proto_header_template,$(libregistrysrcdir)/tools/common.h,$(registry_common_OBJ_FILES:.o=.c)))
################################################
# Start BINARY regdiff
@@ -50,9 +51,9 @@ PRIVATE_DEPENDENCIES = \
# End BINARY regdiff
################################################
-regdiff_OBJ_FILES = lib/registry/tools/regdiff.o
+regdiff_OBJ_FILES = $(libregistrysrcdir)/tools/regdiff.o
-MANPAGES += lib/registry/man/regdiff.1
+MANPAGES += $(libregistrysrcdir)/man/regdiff.1
################################################
# Start BINARY regpatch
@@ -64,9 +65,9 @@ PRIVATE_DEPENDENCIES = \
# End BINARY regpatch
################################################
-regpatch_OBJ_FILES = lib/registry/tools/regpatch.o
+regpatch_OBJ_FILES = $(libregistrysrcdir)/tools/regpatch.o
-MANPAGES += lib/registry/man/regpatch.1
+MANPAGES += $(libregistrysrcdir)/man/regpatch.1
################################################
# Start BINARY regshell
@@ -78,9 +79,9 @@ PRIVATE_DEPENDENCIES = \
# End BINARY regshell
################################################
-regshell_OBJ_FILES = lib/registry/tools/regshell.o
+regshell_OBJ_FILES = $(libregistrysrcdir)/tools/regshell.o
-MANPAGES += lib/registry/man/regshell.1
+MANPAGES += $(libregistrysrcdir)/man/regshell.1
################################################
# Start BINARY regtree
@@ -92,18 +93,19 @@ PRIVATE_DEPENDENCIES = \
# End BINARY regtree
################################################
-regtree_OBJ_FILES = lib/registry/tools/regtree.o
+regtree_OBJ_FILES = $(libregistrysrcdir)/tools/regtree.o
-MANPAGES += lib/registry/man/regtree.1
+MANPAGES += $(libregistrysrcdir)/man/regtree.1
[SUBSYSTEM::torture_registry]
PRIVATE_DEPENDENCIES = registry
-PRIVATE_PROTO_HEADER = tests/proto.h
-torture_registry_OBJ_FILES = $(addprefix lib/registry/tests/, generic.o hive.o diff.o registry.o)
+torture_registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/tests/, generic.o hive.o diff.o registry.o)
+
+$(eval $(call proto_header_template,$(libregistrysrcdir)/tests/proto.h,$(torture_registry_OBJ_FILES:.o=.c)))
[PYTHON::swig_registry]
PUBLIC_DEPENDENCIES = registry
SWIG_FILE = registry.i
-swig_registry_OBJ_FILES = lib/registry/registry_wrap.o
+swig_registry_OBJ_FILES = $(libregistrysrcdir)/registry_wrap.o
diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk
index d33b38cab0..e089149393 100644
--- a/source4/lib/samba3/config.mk
+++ b/source4/lib/samba3/config.mk
@@ -1,9 +1,10 @@
################################################
# Start SUBSYSTEM LIBSAMBA3
[SUBSYSTEM::SMBPASSWD]
-PRIVATE_PROTO_HEADER = samba3_smbpasswd_proto.h
PRIVATE_DEPENDENCIES = CHARSET LIBSAMBA-UTIL
# End SUBSYSTEM LIBSAMBA3
################################################
-SMBPASSWD_OBJ_FILES = lib/samba3/smbpasswd.o
+SMBPASSWD_OBJ_FILES = $(libsrcdir)/samba3/smbpasswd.o
+
+$(eval $(call proto_header_template,$(libsrcdir)/samba3/samba3_smbpasswd_proto.h,$(SMBPASSWD_OBJ_FILES:.o=.c)))
diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk
index 2400190175..18aa806e41 100644
--- a/source4/lib/socket/config.mk
+++ b/source4/lib/socket/config.mk
@@ -1,12 +1,13 @@
##############################
# Start SUBSYSTEM LIBNETIF
[SUBSYSTEM::LIBNETIF]
-PRIVATE_PROTO_HEADER = netif_proto.h
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBREPLACE_NETWORK
# End SUBSYSTEM LIBNETIF
##############################
-LIBNETIF_OBJ_FILES = $(addprefix lib/socket/, interface.o netif.o)
+LIBNETIF_OBJ_FILES = $(addprefix $(libsocketsrcdir)/, interface.o netif.o)
+
+$(eval $(call proto_header_template,$(libsocketsrcdir)/netif_proto.h,$(LIBNETIF_OBJ_FILES:.o=.c)))
################################################
# Start MODULE socket_ip
@@ -17,7 +18,7 @@ PRIVATE_DEPENDENCIES = LIBSAMBA-ERRORS LIBREPLACE_NETWORK
# End MODULE socket_ip
################################################
-socket_ip_OBJ_FILES = lib/socket/socket_ip.o
+socket_ip_OBJ_FILES = $(libsocketsrcdir)/socket_ip.o
################################################
# Start MODULE socket_unix
@@ -28,7 +29,7 @@ PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK
# End MODULE socket_unix
################################################
-socket_unix_OBJ_FILES = lib/socket/socket_unix.o
+socket_unix_OBJ_FILES = $(libsocketsrcdir)/socket_unix.o
################################################
# Start SUBSYSTEM SOCKET
@@ -38,5 +39,5 @@ PRIVATE_DEPENDENCIES = SOCKET_WRAPPER LIBCLI_COMPOSITE LIBCLI_RESOLVE
# End SUBSYSTEM SOCKET
################################################
-samba-socket_OBJ_FILES = $(addprefix lib/socket/, socket.o access.o connect_multi.o connect.o)
+samba-socket_OBJ_FILES = $(addprefix $(libsocketsrcdir)/, socket.o access.o connect_multi.o connect.o)
diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk
index 2067d988cb..60cfb3209a 100644
--- a/source4/lib/socket_wrapper/config.mk
+++ b/source4/lib/socket_wrapper/config.mk
@@ -5,4 +5,4 @@ PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK
# End SUBSYSTEM SOCKET_WRAPPER
##############################
-SOCKET_WRAPPER_OBJ_FILES = lib/socket_wrapper/socket_wrapper.o
+SOCKET_WRAPPER_OBJ_FILES = $(socketwrappersrcdir)/socket_wrapper.o
diff --git a/source4/lib/stream/config.mk b/source4/lib/stream/config.mk
index 52c8525483..56d117e7bd 100644
--- a/source4/lib/stream/config.mk
+++ b/source4/lib/stream/config.mk
@@ -1,4 +1,4 @@
[SUBSYSTEM::LIBPACKET]
PRIVATE_DEPENDENCIES = LIBTLS
-LIBPACKET_OBJ_FILES = lib/stream/packet.o
+LIBPACKET_OBJ_FILES = $(libstreamsrcdir)/packet.o
diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk
index 3e05f6c30c..07506ec647 100644
--- a/source4/lib/tdr/config.mk
+++ b/source4/lib/tdr/config.mk
@@ -1,8 +1,9 @@
[SUBSYSTEM::TDR]
CFLAGS = -Ilib/tdr
-PRIVATE_PROTO_HEADER = tdr_proto.h
PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL
-TDR_OBJ_FILES = lib/tdr/tdr.o
+TDR_OBJ_FILES = $(libtdrsrcdir)/tdr.o
-PUBLIC_HEADERS += lib/tdr/tdr.h
+$(eval $(call proto_header_template,$(libtdrsrcdir)/tdr_proto.h,$(TDR_OBJ_FILES:.o=.c)))
+
+PUBLIC_HEADERS += $(libtdrsrcdir)/tdr.h
diff --git a/source4/lib/tls/config.mk b/source4/lib/tls/config.mk
index e2d7cd517a..e01f79ce10 100644
--- a/source4/lib/tls/config.mk
+++ b/source4/lib/tls/config.mk
@@ -2,4 +2,4 @@
PUBLIC_DEPENDENCIES = \
LIBTALLOC GNUTLS LIBSAMBA-HOSTCONFIG samba-socket
-LIBTLS_OBJ_FILES = lib/tls/tls.o lib/tls/tlscert.o
+LIBTLS_OBJ_FILES = $(addprefix $(libtlssrcdir)/, tls.o tlscert.o)
diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk
index 888e285e95..49e7b1a171 100644
--- a/source4/lib/torture/config.mk
+++ b/source4/lib/torture/config.mk
@@ -8,7 +8,7 @@ PUBLIC_DEPENDENCIES = \
torture_VERSION = 0.0.1
torture_SOVERSION = 0
-PC_FILES += lib/torture/torture.pc
-torture_OBJ_FILES = $(addprefix lib/torture/, torture.o)
+PC_FILES += $(libtorturesrcdir)/torture.pc
+torture_OBJ_FILES = $(addprefix $(libtorturesrcdir)/, torture.o)
-PUBLIC_HEADERS += lib/torture/torture.h
+PUBLIC_HEADERS += $(libtorturesrcdir)/torture.h
diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk
index 5a4b831ed5..925713a53c 100644
--- a/source4/lib/util/config.mk
+++ b/source4/lib/util/config.mk
@@ -4,7 +4,7 @@ PUBLIC_DEPENDENCIES = \
SOCKET_WRAPPER LIBREPLACE_NETWORK \
CHARSET EXECINFO
-LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \
+LIBSAMBA-UTIL_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \
xfile.o \
debug.o \
fault.o \
@@ -25,7 +25,7 @@ LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \
become_daemon.o \
params.o)
-PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
+PUBLIC_HEADERS += $(addprefix $(libutilsrcdir)/, util.h \
attr.h \
byteorder.h \
data_blob.h \
@@ -37,14 +37,16 @@ PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
xfile.h)
[SUBSYSTEM::ASN1_UTIL]
-PRIVATE_PROTO_HEADER = asn1_proto.h
-ASN1_UTIL_OBJ_FILES = lib/util/asn1.o
+ASN1_UTIL_OBJ_FILES = $(libutilsrcdir)/asn1.o
+
+$(eval $(call proto_header_template,$(libutilsrcdir)/asn1_proto.h,$(ASN1_UTIL_OBJ_FILES:.o=.c)))
[SUBSYSTEM::UNIX_PRIVS]
-PRIVATE_PROTO_HEADER = unix_privs.h
-UNIX_PRIVS_OBJ_FILES = lib/util/unix_privs.o
+UNIX_PRIVS_OBJ_FILES = $(libutilsrcdir)/unix_privs.o
+
+$(eval $(call proto_header_template,$(libutilsrcdir)/unix_privs.h,$(UNIX_PRIVS_OBJ_FILES:.o=.c)))
################################################
# Start SUBSYSTEM WRAP_XATTR
@@ -54,15 +56,16 @@ PUBLIC_DEPENDENCIES = XATTR
# End SUBSYSTEM WRAP_XATTR
################################################
-WRAP_XATTR_OBJ_FILES = lib/util/wrap_xattr.o
+WRAP_XATTR_OBJ_FILES = $(libutilsrcdir)/wrap_xattr.o
[SUBSYSTEM::UTIL_TDB]
-PRIVATE_PROTO_HEADER = util_tdb.h
PUBLIC_DEPENDENCIES = LIBTDB
-UTIL_TDB_OBJ_FILES = lib/util/util_tdb.o
+UTIL_TDB_OBJ_FILES = $(libutilsrcdir)/util_tdb.o
+
+$(eval $(call proto_header_template,$(libutilsrcdir)/util_tdb.h,$(UTIL_TDB_OBJ_FILES:.o=.c)))
[SUBSYSTEM::UTIL_LDB]
PUBLIC_DEPENDENCIES = LIBLDB
-UTIL_LDB_OBJ_FILES = lib/util/util_ldb.o
+UTIL_LDB_OBJ_FILES = $(libutilsrcdir)/util_ldb.o