~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to source4/build/make/templates.mk

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Templates file for Samba 4
 
2
# This relies on GNU make.
 
3
#
 
4
# © 2008 Jelmer Vernooij <jelmer@samba.org>
 
5
#
 
6
###############################################################################
 
7
# Templates
 
8
###############################################################################
 
9
 
 
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
 
18
 
 
19
# Link a binary
 
20
# Arguments: target file, depends, flags
 
21
define binary_link_template
 
22
$(1): $(2) ;
 
23
        @echo Linking $$@
 
24
        @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
 
25
 
 
26
clean::
 
27
        @rm -f $(1)
 
28
 
 
29
binaries:: $(1)
 
30
 
 
31
endef
 
32
 
 
33
# Link a host-machine binary
 
34
# Arguments: target file, depends, flags
 
35
define host_binary_link_template
 
36
$(1): $(2) ;
 
37
        @echo Linking $$@
 
38
        @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
 
39
 
 
40
clean::
 
41
        rm -f $(1)
 
42
 
 
43
binaries:: $(1)
 
44
 
 
45
endef
 
46
 
 
47
# Create a prototype header
 
48
# Arguments: header file, c files
 
49
define proto_header_template
 
50
 
 
51
proto:: $(1) ;
 
52
 
 
53
clean:: ;
 
54
        rm -f $(1)
 
55
 
 
56
$(1): $(2) ;
 
57
        @echo "Creating $$@"
 
58
        @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^
 
59
 
 
60
endef
 
61
 
 
62
# Shared module
 
63
# Arguments: Target, dependencies, objects
 
64
define shared_module_template
 
65
 
 
66
$(1): $(2) ;
 
67
        @echo Linking $$@
 
68
        @mkdir -p $$(@D)
 
69
        @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
 
70
 
 
71
endef
 
72
 
 
73
# Shared library
 
74
# Arguments: Target, dependencies, link flags, soname
 
75
define shared_library_template
 
76
$(1): $(2)
 
77
        @echo Linking $$@
 
78
        @mkdir -p $$(@D)
 
79
        @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
 
80
                $(3) \
 
81
                $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4)))
 
82
 
 
83
ifneq ($(notdir $(1)),$(notdir $(4)))
 
84
$(4): $(1)
 
85
        @echo "Creating symbolic link for $$@"
 
86
        @ln -fs $$(<F) $$@
 
87
endif
 
88
 
 
89
ifneq ($(notdir $(1)),$(notdir $(5)))
 
90
$(5): $(1) $(4)
 
91
        @echo "Creating symbolic link for $$@"
 
92
        @ln -fs $$(<F) $$@
 
93
endif
 
94
endef
 
95
 
 
96
# Shared alias
 
97
# Arguments: Target, subsystem name, alias name
 
98
define shared_module_alias_template
 
99
bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
 
100
        @ln -fs $$(<F) $$@
 
101
 
 
102
PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
 
103
 
 
104
uninstallplugins::
 
105
        @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
 
106
installplugins::
 
107
        @ln -fs $(notdir $(1)) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
 
108
 
 
109
endef
 
110
 
 
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)
 
116
uninstallplugins::
 
117
        @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
 
118
        @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
 
119
 
 
120
endef
 
121
 
 
122
# abspath for older makes
 
123
abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
 
124
 
 
125
# Install a binary
 
126
# Arguments: path to binary to install
 
127
define binary_install_template
 
128
installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1)) installdirs
 
129
 
 
130
uninstallbin::
 
131
        @echo "Removing $(notdir $(1))"
 
132
        @rm -f $$(DESTDIR)$$(bindir)/$(notdir $(1))
 
133
endef
 
134
 
 
135
define sbinary_install_template
 
136
installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1)) installdirs
 
137
 
 
138
uninstallsbin::
 
139
        @echo "Removing $(notdir $(1))"
 
140
        @rm -f $$(DESTDIR)$$(sbindir)/$(notdir $(1))
 
141
endef