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=$$@ $$^
63 # Arguments: Target, dependencies, objects
64 define shared_module_template
69 @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
74 # Arguments: Target, dependencies, link flags, soname
75 define shared_library_template
79 @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
81 $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4)))
83 ifneq ($(notdir $(1)),$(notdir $(4)))
85 @echo "Creating symbolic link for $$@"
89 ifneq ($(notdir $(1)),$(notdir $(5)))
91 @echo "Creating symbolic link for $$@"
97 # Arguments: Target, subsystem name, alias name
98 define shared_module_alias_template
99 bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
102 PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
105 @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
107 @ln -fs $(notdir $(1)) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
111 define shared_module_install_template
112 installplugins:: bin/modules/$(1)/$(2)
113 @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
114 @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/
115 @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
117 @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
118 @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
122 # abspath for older makes
123 abspath := $(shell cd $(1); pwd)
125 define binary_install_template
126 inst@allbin:: $(1) installdirs
127 @mkdir -p $$(DESTDIR)$$(bindir)
128 @$$(SHELL) $$(srcdir)/script/installbin.sh \
130 $$(DESTDIR)$$(BASEDIR) \
131 $$(DESTDIR)$$(bindir) \
132 $$(DESTDIR)$$(libdir) \
133 $$(DESTDIR)$$(localstatedir) \
137 @rm -f $$(DESTDIR)$$(bindir)/$(1)
140 define sbinary_install_template
141 installsbin:: $(1) installdirs
142 @mkdir -p $$(DESTDIR)$$(sbindir)
143 @$$(SHELL) $$(srcdir)/script/installbin.sh \
145 $$(DESTDIR)$$(BASEDIR) \
146 $$(DESTDIR)$$(sbindir) \
147 $$(DESTDIR)$$(libdir) \
148 $$(DESTDIR)$$(localstatedir) \
152 @rm -f $$(DESTDIR)$$(sbindir)/$(1)