1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

wafsamba: generate an empty.c file if a SAMBA_{LIBRARY,SUBSYSTEM} doesn't have any source files

This is better than passing '-' as filename to the compiler/linker.
This replaces commit 65743f932b.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=9334
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10315

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Stefan Metzmacher 2014-12-19 13:10:30 +01:00 committed by Jeremy Allison
parent a6bda1f2bc
commit d7bd51a79d

View File

@ -94,6 +94,11 @@ def ADD_INIT_FUNCTION(bld, subsystem, target, init_function):
Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
def generate_empty_file(task):
target_fname = installed_location=task.outputs[0].bldpath(task.env)
target_file = open(installed_location, 'w')
target_file.close()
return 0
#################################################################
def SAMBA_LIBRARY(bld, libname, source,
@ -149,9 +154,15 @@ def SAMBA_LIBRARY(bld, libname, source,
source = bld.SUBDIR(subdir, source)
# remember empty libraries, so we can strip the dependencies
if ((source == '') or (source == [])) and deps == '' and public_deps == '':
SET_TARGET_TYPE(bld, libname, 'EMPTY')
return
if ((source == '') or (source == [])):
if deps == '' and public_deps == '':
SET_TARGET_TYPE(bld, libname, 'EMPTY')
return
empty_c = libname + '.empty.c'
bld.SAMBA_GENERATOR('%s_empty_c' % libname,
rule=generate_empty_file,
target=empty_c)
source=empty_c
if BUILTIN_LIBRARY(bld, libname):
obj_target = libname
@ -537,9 +548,15 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
return
# remember empty subsystems, so we can strip the dependencies
if ((source == '') or (source == [])) and deps == '' and public_deps == '':
SET_TARGET_TYPE(bld, modname, 'EMPTY')
return
if ((source == '') or (source == [])):
if deps == '' and public_deps == '':
SET_TARGET_TYPE(bld, modname, 'EMPTY')
return
empty_c = modname + '.empty.c'
bld.SAMBA_GENERATOR('%s_empty_c' % modname,
rule=generate_empty_file,
target=empty_c)
source=empty_c
if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
return