• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/samba-3.5.8/source4/build/make/
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
12define partial_link_template 
13$(1): $(2) ;
14	@echo Partially linking $$@
15	@mkdir -p $$(@D)
16	$$(PARTLINK) -o $$@ $$^
17endef
18
19# Link a binary
20# Arguments: target file, depends, flags
21define binary_link_template
22$(1): $(2) ;
23	@echo Linking $$@
24	@$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
25
26clean::
27	@rm -f $(1)
28
29binaries:: $(1)
30
31endef
32
33# Link a host-machine binary
34# Arguments: target file, depends, flags
35define host_binary_link_template
36$(1): $(2) ;
37	@echo Linking $$@
38	@$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
39
40clean::
41	rm -f $(1)
42
43binaries:: $(1)
44
45endef
46
47# Create a prototype header
48# Arguments: header file, c files
49define proto_header_template
50
51proto:: $(1) ;
52
53clean:: ;
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$($(2):.c=.o): $(1) ;
61
62endef
63
64# Shared module
65# Arguments: Target, dependencies, objects
66define shared_module_template
67
68$(1): $(2) ;
69	@echo Linking $$@
70	@mkdir -p $$(@D)
71	@$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
72
73endef
74
75# Shared library
76# Arguments: Target, dependencies, link flags, soname
77define shared_library_template
78$(1): $(2)
79	@echo Linking $$@
80	@mkdir -p $$(@D)
81	@$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
82		$(3) \
83		$$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4)))
84
85ifneq ($(notdir $(1)),$(notdir $(4)))
86$(4): $(1)
87	@echo "Creating symbolic link for $$@"
88	@ln -fs $$(<F) $$@
89endif
90
91ifneq ($(notdir $(1)),$(notdir $(5)))
92$(5): $(1) $(4)
93	@echo "Creating symbolic link for $$@"
94	@ln -fs $$(<F) $$@
95endif
96endef
97
98# Shared alias
99# Arguments: Target, subsystem name, alias name
100define shared_module_alias_template
101bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
102	@ln -fs $$(<F) $$@
103
104PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
105
106uninstallplugins::
107	@-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
108installplugins::
109	@ln -fs $(notdir $(1)) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
110
111endef
112
113define shared_module_install_template
114installplugins:: 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)
118uninstallplugins::
119	@echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
120	@-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
121
122endef
123
124# abspath for older makes
125abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
126
127# Install a binary
128# Arguments: path to binary to install
129define binary_install_template
130installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1)) installdirs
131
132uninstallbin::
133	@echo "Removing $(notdir $(1))"
134	@rm -f $$(DESTDIR)$$(bindir)/$(notdir $(1))
135endef
136
137define sbinary_install_template
138installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1)) installdirs
139
140uninstallsbin::
141	@echo "Removing $(notdir $(1))"
142	@rm -f $$(DESTDIR)$$(sbindir)/$(notdir $(1))
143endef
144