add a test for a LSA lookupnames with a NULL string
[Samba/gbeck.git] / source3 / samba4-templates.mk
blob154c3aabda7487be63f981b8e017f16ca113232b
1 # Templates file for Samba 4
2 # This relies on GNU make.
4 # © 2008 Jelmer Vernooij <jelmer@samba.org>
6 ###############################################################################
7 # Templates
8 ###############################################################################
10 # Partially link
11 # Arguments: target object file, source object files
12 define partial_link_template
13 $(1): $(2) ;
14 @echo Partially linking $$@
15 @mkdir -p $$(@D)
16 @$$(PARTLINK) -o $$@ $$^
17 endef
19 # Link a binary
20 # Arguments: target file, depends, flags
21 define binary_link_template
22 $(1)4: $(2) $(LIBREPLACE_OBJ) ;
23 @echo Linking $$@
24 @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBS) $$(LIBREPLACE_OBJ)
25 clean::
26 @rm -f $(1)
28 binaries:: $(1)
31 endef
33 # Link a host-machine binary
34 # Arguments: target file, depends, flags
35 define host_binary_link_template
36 $(1)4: $(2) $(LIBREPLACE_OBJ) ;
37 @echo Linking $$@
38 @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBREPLACE_OBJ)
40 clean::
41 rm -f $(1)
43 binaries:: $(1)
46 endef
48 # Create a prototype header
49 # Arguments: header file, c files
50 define proto_header_template
51 echo:: ;
52 echo $(1) ;
54 proto:: $(1) ;
56 clean:: ;
57 rm -f $(1) ;
59 $(1): $(2) ;
60 @echo "Creating $$@"
61 @$$(PERL) $$(srcdir)/../source4/script/mkproto.pl --srcdir=$$(srcdir)/../source4 --builddir=$$(builddir)/../source4 --public=/dev/null --private=$$@ $$^
62 endef
64 # Shared module
65 # Arguments: Target, dependencies, objects
66 define shared_module_template
68 $(1): $(2) ;
69 @echo Linking $$@
70 @mkdir -p $$(@D)
71 @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
73 PLUGINS += $(1)
75 endef
77 # Shared library
78 # Arguments: Target, dependencies, link flags, soname
79 define shared_library_template
80 $(1): $(2)
81 @echo Linking $$@
82 @mkdir -p $$(@D)
83 @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
84 $(3) \
85 $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4))) $$(LIBS)
87 ifneq ($(notdir $(1)),$(notdir $(4)))
88 $(4): $(1)
89 @echo "Creating symbolic link for $$@"
90 @ln -fs $$(<F) $$@
91 endif
93 ifneq ($(notdir $(1)),$(notdir $(5)))
94 $(5): $(1)
95 @echo "Creating symbolic link for $$@"
96 @ln -fs $$(<F) $$@
97 endif
98 endef
100 # Shared alias
101 # Arguments: Target, subsystem name, alias name
102 define shared_module_alias_template
103 bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
104 @ln -fs $$(<F) $$@
106 PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
108 uninstallplugins::
109 @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
110 installplugins::
111 @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
113 endef
115 define shared_module_install_template
116 installplugins:: bin/modules/$(1)/$(2)
117 @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
118 @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/
119 @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
120 uninstallplugins::
121 @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
122 @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
124 endef
126 # abspath for older makes
127 abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
129 # Install a binary
130 # Arguments: path to binary to install
131 define binary_install_template
132 installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1))4
134 uninstallbin::
135 @echo "Removing $(notdir $(1))4"
136 @rm -f $$(DESTDIR)$$(bindir)/$(1)4
137 endef
139 define sbinary_install_template
140 installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1))4 installdirs
142 uninstallsbin::
143 @echo "Removing $(notdir $(1))4"
144 @rm -f $$(DESTDIR)$$(sbindir)/$(1)4
145 endef