1 # Templates file for Samba 4
2 # This relies on GNU make.
4 # © 2008 Jelmer Vernooij <jelmer@samba.org>
6 ###############################################################################
8 ###############################################################################
11 # Arguments: target object file, source object files
12 define partial_link_template
14 @echo Partially linking $$@
16 @$$(PARTLINK) -o $$@ $$^
20 # Arguments: target file, depends, flags
21 define binary_link_template
24 @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBS)
32 # Link a host-machine binary
33 # Arguments: target file, depends, flags
34 define host_binary_link_template
37 @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
47 # Create a prototype header
48 # Arguments: header file, c files
49 define proto_header_template
60 @$$(PERL) $$(srcdir)/../source4/script/mkproto.pl --srcdir=$$(srcdir)/../source4 --builddir=$$(builddir)/../source4 --public=/dev/null --private=$$@ $$^
64 # Arguments: Target, dependencies, objects
65 define shared_module_template
70 @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
77 # Arguments: Target, dependencies, link flags, soname
78 define shared_library_template
82 @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
84 $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4))) $$(LIBS)
86 ifneq ($(notdir $(1)),$(notdir $(4)))
88 @echo "Creating symbolic link for $$@"
92 ifneq ($(notdir $(1)),$(notdir $(5)))
94 @echo "Creating symbolic link for $$@"
100 # Arguments: Target, subsystem name, alias name
101 define shared_module_alias_template
102 bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
105 PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
108 @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
110 @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
114 define shared_module_install_template
115 installplugins:: bin/modules/$(1)/$(2)
116 @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
117 @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/
118 @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
120 @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
121 @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
125 # abspath for older makes
126 abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
129 # Arguments: path to binary to install
130 define binary_install_template
131 installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1))4
134 @echo "Removing $(notdir $(1))4"
135 @rm -f $$(DESTDIR)$$(bindir)/$(1)4
138 define sbinary_install_template
139 installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1))4 installdirs
142 @echo "Removing $(notdir $(1))4"
143 @rm -f $$(DESTDIR)$$(sbindir)/$(1)4