2008-09-15 16:30:15 +04:00
# Templates file for Samba 4
# This relies on GNU make.
#
# © 2008 Jelmer Vernooij <jelmer@samba.org>
#
###############################################################################
# Templates
###############################################################################
# Partially link
# Arguments: target object file, source object files
d e f i n e p a r t i a l _ l i n k _ t e m p l a t e
$(1) : $( 2) ;
@echo Partially linking $$ @
@mkdir -p $$ ( @D)
@$$ ( PARTLINK) -o $$ @ $$ ^
e n d e f
# Link a binary
# Arguments: target file, depends, flags
d e f i n e b i n a r y _ l i n k _ t e m p l a t e
$(1)4 : $( 2) $( LIBREPLACE_OBJ ) ;
@echo Linking $$ @
@$$ ( BNLD) $$ ( BNLD_FLAGS) $$ ( INTERN_LDFLAGS) -o $$ @ $$ ( INSTALL_LINK_FLAGS) $( 3) $$ ( LIBS) $$ ( LIBREPLACE_OBJ)
clean ::
@rm -f $( 1)
binaries :: $( 1)
e n d e f
# Link a host-machine binary
# Arguments: target file, depends, flags
d e f i n e h o s t _ b i n a r y _ l i n k _ t e m p l a t e
$(1)4 : $( 2) $( LIBREPLACE_OBJ ) ;
@echo Linking $$ @
@$$ ( HOSTLD) $$ ( HOSTLD_FLAGS) -L$$ { builddir} /bin/static -o $$ @ $$ ( INSTALL_LINK_FLAGS) $( 3) $$ ( LIBREPLACE_OBJ)
clean ::
rm -f $( 1)
binaries :: $( 1)
e n d e f
# Create a prototype header
# Arguments: header file, c files
d e f i n e p r o t o _ h e a d e r _ t e m p l a t e
echo :: ;
echo $( 1) ;
proto :: $( 1) ;
clean :: ;
rm -f $( 1) ;
$(1) : $( 2) ;
@echo " Creating $$ @ "
2008-09-15 16:32:58 +04:00
@$$ ( PERL) $$ ( srcdir) /../source4/script/mkproto.pl --srcdir= $$ ( srcdir) /../source4 --builddir= $$ ( builddir) /../source4 --public= /dev/null --private= $$ @ $$ ^
2008-09-15 16:30:15 +04:00
e n d e f
# Shared module
# Arguments: Target, dependencies, objects
d e f i n e s h a r e d _ m o d u l e _ t e m p l a t e
$(1) : $( 2) ;
@echo Linking $$ @
@mkdir -p $$ ( @D)
@$$ ( MDLD) $$ ( LDFLAGS) $$ ( MDLD_FLAGS) $$ ( INTERN_LDFLAGS) -o $$ @ $$ ( INSTALL_LINK_FLAGS) $( 3)
PLUGINS += $( 1)
e n d e f
# Shared library
# Arguments: Target, dependencies, link flags, soname
d e f i n e s h a r e d _ l i b r a r y _ t e m p l a t e
$(1) : $( 2)
@echo Linking $$ @
@mkdir -p $$ ( @D)
@$$ ( SHLD) $$ ( LDFLAGS) $$ ( SHLD_FLAGS) $$ ( INTERN_LDFLAGS) -o $$ @ $$ ( INSTALL_LINK_FLAGS) \
$( 3) \
$$ ( if $$ ( SONAMEFLAG) , $$ ( SONAMEFLAG) $( notdir $( 4) ) ) $$ ( LIBS)
i f n e q ( $( notdir $ ( 1) ) , $( notdir $ ( 4) ) )
$(4) : $( 1)
@echo " Creating symbolic link for $$ @ "
@ln -fs $$ ( <F) $$ @
e n d i f
i f n e q ( $( notdir $ ( 1) ) , $( notdir $ ( 5) ) )
$(5) : $( 1)
@echo " Creating symbolic link for $$ @ "
@ln -fs $$ ( <F) $$ @
e n d i f
e n d e f
# Shared alias
# Arguments: Target, subsystem name, alias name
d e f i n e s h a r e d _ m o d u l e _ a l i a s _ t e m p l a t e
bin/modules/$(2)/$(3).$$(SHLIBEXT) : $( 1)
@ln -fs $$ ( <F) $$ @
PLUGINS += bin/modules/$( 2) /$( 3) .$$ ( SHLIBEXT)
uninstallplugins ::
@-rm $$ ( DESTDIR) $$ ( modulesdir) /$( 2) /$( 3) .$$ ( SHLIBEXT)
installplugins ::
@ln -fs $( 1) $$ ( DESTDIR) $$ ( modulesdir) /$( 2) /$( 3) .$$ ( SHLIBEXT)
e n d e f
d e f i n e s h a r e d _ m o d u l e _ i n s t a l l _ t e m p l a t e
installplugins :: bin /modules /$( 1) /$( 2)
@echo Installing $( 2) as $$ ( DESTDIR) $$ ( modulesdir) /$( 1) /$( 2)
@mkdir -p $$ ( DESTDIR) $$ ( modulesdir) /$( 1) /
@cp bin/modules/$( 1) /$( 2) $$ ( DESTDIR) $$ ( modulesdir) /$( 1) /$( 2)
uninstallplugins ::
@echo Uninstalling $$ ( DESTDIR) $$ ( modulesdir) /$( 1) /$( 2)
@-rm $$ ( DESTDIR) $$ ( modulesdir) /$( 1) /$( 2)
e n d e f
# abspath for older makes
abspath = $( shell cd $( dir $( 1) ) ; pwd ) /$( notdir $( 1) )
# Install a binary
# Arguments: path to binary to install
d e f i n e b i n a r y _ i n s t a l l _ t e m p l a t e
installbin :: $$( DESTDIR ) $$( bindir ) /$( notdir $ ( 1) ) 4
uninstallbin ::
@echo " Removing $( notdir $( 1) ) 4 "
@rm -f $$ ( DESTDIR) $$ ( bindir) /$( 1) 4
e n d e f
d e f i n e s b i n a r y _ i n s t a l l _ t e m p l a t e
installsbin :: $$( DESTDIR ) $$( sbindir ) /$( notdir $ ( 1) ) 4 installdirs
uninstallsbin ::
@echo " Removing $( notdir $( 1) ) 4 "
@rm -f $$ ( DESTDIR) $$ ( sbindir) /$( 1) 4
e n d e f