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)
33 # Link a host-machine binary
34 # Arguments: target file, depends, flags
35 define host_binary_link_template
38 @$$(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
58 @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^
65 # Arguments: Target, dependencies, objects
66 define shared_module_template
71 @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
76 # Arguments: Target, dependencies, link flags, soname
77 define shared_library_template
81 @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
83 $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4)))
85 ifneq ($(notdir $(1)),$(notdir $(4)))
87 @echo "Creating symbolic link for $$@"
91 ifneq ($(notdir $(1)),$(notdir $(5)))
93 @echo "Creating symbolic link for $$@"
99 # Arguments: Target, subsystem name, alias name
100 define shared_module_alias_template
101 bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
104 PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
107 @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
109 @ln -fs $(notdir $(1)) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
113 define shared_module_install_template
114 installplugins:: bin/modules/$(1)/$(2)
115 @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
116 @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/
117 @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
119 @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
120 @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
124 # abspath for older makes
125 abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
128 # Arguments: path to binary to install
129 define binary_install_template
130 installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1)) installdirs
133 @echo "Removing $(notdir $(1))"
134 @rm -f $$(DESTDIR)$$(bindir)/$(notdir $(1))
137 define sbinary_install_template
138 installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1)) installdirs
141 @echo "Removing $(notdir $(1))"
142 @rm -f $$(DESTDIR)$$(sbindir)/$(notdir $(1))