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
22 $(1)4: $(2) $(LIBREPLACE_OBJ) ;
24 @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBS) $$(LIBREPLACE_OBJ)
33 # Link a host-machine binary
34 # Arguments: target file, depends, flags
35 define host_binary_link_template
36 $(1)4: $(2) $(LIBREPLACE_OBJ) ;
38 @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBREPLACE_OBJ)
48 # Create a prototype header
49 # Arguments: header file, c files
50 define proto_header_template
61 @$$(PERL) $$(srcdir)/../source4/script/mkproto.pl --srcdir=$$(srcdir)/../source4 --builddir=$$(builddir)/../source4 --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)
78 # Arguments: Target, dependencies, link flags, soname
79 define shared_library_template
83 @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
85 $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4))) $$(LIBS)
87 ifneq ($(notdir $(1)),$(notdir $(4)))
89 @echo "Creating symbolic link for $$@"
93 ifneq ($(notdir $(1)),$(notdir $(5)))
95 @echo "Creating symbolic link for $$@"
101 # Arguments: Target, subsystem name, alias name
102 define shared_module_alias_template
103 bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
106 PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
109 @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
111 @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
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)
121 @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
122 @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
126 # abspath for older makes
127 abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
130 # Arguments: path to binary to install
131 define binary_install_template
132 installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1))4
135 @echo "Removing $(notdir $(1))4"
136 @rm -f $$(DESTDIR)$$(bindir)/$(1)4
139 define sbinary_install_template
140 installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1))4 installdirs
143 @echo "Removing $(notdir $(1))4"
144 @rm -f $$(DESTDIR)$$(sbindir)/$(1)4