mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 09:19:28 +00:00
Bug 1378830 - part 1 - define PROG_IS_C_ONLY variables for PROGRAM and SIMPLE_PROGRAMS; r=chmanchester
Similar to the existing LIB_IS_C_ONLY variable, these variables indicate that the program in question has only C sources and so can be linked by the C compiler rather than the C++ compiler. We need to add a little more information to BaseProgram so we can avoid emitting periods into Makefile variables.
This commit is contained in:
parent
a4e30a204e
commit
c150b738a2
@ -566,6 +566,10 @@ alltags:
|
||||
$(RM) TAGS
|
||||
find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
|
||||
|
||||
define EXPAND_CC_OR_CXX
|
||||
$(if $(PROG_IS_C_ONLY_$(1)),$(EXPAND_CC),$(EXPAND_CCC))
|
||||
endef
|
||||
|
||||
#
|
||||
# PROGRAM = Foo
|
||||
# creates OBJS, links with LIBS to create Foo
|
||||
@ -595,7 +599,7 @@ ifdef MOZ_PROFILE_GENERATE
|
||||
touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
|
||||
endif
|
||||
else # !WINNT || GNU_CC
|
||||
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
|
||||
$(call EXPAND_CC_OR_CXX,$@) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE)
|
||||
$(call CHECK_BINARY,$@)
|
||||
endif # WINNT && !GNU_CC
|
||||
|
||||
@ -654,7 +658,7 @@ ifdef MSMANIFEST_TOOL
|
||||
fi
|
||||
endif # MSVC with manifest tool
|
||||
else
|
||||
$(EXPAND_CCC) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS)
|
||||
$(call EXPAND_CC_OR_CXX,$@) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(EXTRA_LIBS) $(OS_LIBS) $(BIN_FLAGS)
|
||||
$(call CHECK_BINARY,$@)
|
||||
endif # WINNT && !GNU_CC
|
||||
|
||||
|
@ -141,6 +141,7 @@ class ConfigEnvironment(object):
|
||||
else:
|
||||
self.import_prefix = self.dll_prefix
|
||||
self.import_suffix = self.dll_suffix
|
||||
self.bin_suffix = self.substs.get('BIN_SUFFIX', '')
|
||||
|
||||
global_defines = [name for name in self.defines
|
||||
if not name in self.non_global_defines]
|
||||
|
@ -571,7 +571,7 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
self._compile_graph[build_target]
|
||||
|
||||
elif isinstance(obj, Program):
|
||||
self._process_program(obj.program, backend_file)
|
||||
self._process_program(obj, backend_file)
|
||||
self._process_linked_libraries(obj, backend_file)
|
||||
self._no_skip['syms'].add(backend_file.relobjdir)
|
||||
|
||||
@ -1093,8 +1093,10 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
registered_xpt_files=' '.join(sorted(registered_xpt_files)),
|
||||
))
|
||||
|
||||
def _process_program(self, program, backend_file):
|
||||
backend_file.write('PROGRAM = %s\n' % program)
|
||||
def _process_program(self, obj, backend_file):
|
||||
backend_file.write('PROGRAM = %s\n' % obj.program)
|
||||
if not obj.cxx_link and not self.environment.bin_suffix:
|
||||
backend_file.write('PROG_IS_C_ONLY_%s := 1\n' % obj.program)
|
||||
|
||||
def _process_host_program(self, program, backend_file):
|
||||
backend_file.write('HOST_PROGRAM = %s\n' % program)
|
||||
@ -1120,8 +1122,11 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
def _process_simple_program(self, obj, backend_file):
|
||||
if obj.is_unit_test:
|
||||
backend_file.write('CPP_UNIT_TESTS += %s\n' % obj.program)
|
||||
assert obj.cxx_link
|
||||
else:
|
||||
backend_file.write('SIMPLE_PROGRAMS += %s\n' % obj.program)
|
||||
if not obj.cxx_link and not self.environment.bin_suffix:
|
||||
backend_file.write('PROG_IS_C_ONLY_%s := 1\n' % obj.program)
|
||||
|
||||
def _process_host_simple_program(self, program, backend_file):
|
||||
backend_file.write('HOST_SIMPLE_PROGRAMS += %s\n' % program)
|
||||
|
Loading…
x
Reference in New Issue
Block a user