s3: Rename new parameter "ldap ref follow" to "ldap follow referral".
[Samba/gebeck_regimport.git] / source3 / samba4-templates.mk
blob0024a7531f3d83157d328d2bba1fadb73b7c790d
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) ;
23 @echo Linking $$@
24 @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBS)
25 clean::
26 @rm -f $(1)
28 everything:: $(1)4
30 endef
32 # Link a host-machine binary
33 # Arguments: target file, depends, flags
34 define host_binary_link_template
35 $(1)4: $(2) ;
36 @echo Linking $$@
37 @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
39 clean::
40 rm -f $(1)
42 binaries:: $(1)4
45 endef
47 # Create a prototype header
48 # Arguments: header file, c files
49 define proto_header_template
50 echo:: ;
51 echo $(1) ;
53 proto:: $(1) ;
55 clean:: ;
56 rm -f $(1) ;
58 $(1): $(2) ;
59 @echo "Creating $$@"
60 @$$(PERL) $$(srcdir)/../source4/script/mkproto.pl --srcdir=$$(srcdir)/../source4 --builddir=$$(builddir)/../source4 --public=/dev/null --private=$$@ $$^
61 endef
63 # Shared module
64 # Arguments: Target, dependencies, objects
65 define shared_module_template
67 $(1): $(2) ;
68 @echo Linking $$@
69 @mkdir -p $$(@D)
70 @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
72 PLUGINS += $(1)
74 endef
76 # Shared library
77 # Arguments: Target, dependencies, link flags, soname
78 define shared_library_template
79 $(1): $(2)
80 @echo Linking $$@
81 @mkdir -p $$(@D)
82 @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
83 $(3) \
84 $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4))) $$(LIBS)
86 ifneq ($(notdir $(1)),$(notdir $(4)))
87 $(4): $(1)
88 @echo "Creating symbolic link for $$@"
89 @ln -fs $$(<F) $$@
90 endif
92 ifneq ($(notdir $(1)),$(notdir $(5)))
93 $(5): $(1) $(4)
94 @echo "Creating symbolic link for $$@"
95 @ln -fs $$(<F) $$@
96 endif
97 endef
99 # Shared alias
100 # Arguments: Target, subsystem name, alias name
101 define shared_module_alias_template
102 bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
103 @ln -fs $$(<F) $$@
105 PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
107 uninstallplugins::
108 @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
109 installplugins::
110 @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
112 endef
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)
119 uninstallplugins::
120 @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
121 @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
123 endef
125 # abspath for older makes
126 abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
128 # Install a binary
129 # Arguments: path to binary to install
130 define binary_install_template
131 installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1))4
133 uninstallbin::
134 @echo "Removing $(notdir $(1))4"
135 @rm -f $$(DESTDIR)$$(bindir)/$(1)4
136 endef
138 define sbinary_install_template
139 installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1))4 installdirs
141 uninstallsbin::
142 @echo "Removing $(notdir $(1))4"
143 @rm -f $$(DESTDIR)$$(sbindir)/$(1)4
144 endef