Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please pull build improvements (and one code fix) from master #22

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

kevin-dot-pyle
Copy link

This pull request covers various build system improvements and one minor bug fix in the generated C code.

Build system:

  • Mark some fake targets as PHONY to improve make handling
  • Support compiling a plugin for a gcc other than the compiler used to build the plugin. Commit b4d2623 provides this for cross-compilers of the same version as the build compiler. Commit c33eb32 makes this work if the host system cannot run output from the cross-compiler. Commit 1b44a06 extends this to allow compiling the plugin to run in a major version of gcc other than the one used to build it (e.g. build using gcc 4.8 to run in gcc 4.9, whether cross or native).
  • Direct invocation of g++ when appropriate, rather than using gcc -x c++. This allows the Makefile to pass CXXFLAGS when needed, rather than passing CFLAGS to the C++ compiler.
  • Parallel build fix: avoid competing runs of xml-to-h.py in parallel builds.
  • Parallel build fix: ensure top level generated files used by gcc-c-api are generated before recursing into gcc-c-api, which assumes they will be present and has no rules to generate them.

Generated code bug fix:

  • Using nullable_ptr caused a docstring of None to be converted into (char)"NULL"* in the generated C code, thereby documenting the object with the word NULL. Commit 650ae20 changes the code to instead generate an unquoted NULL, so that the object is recorded as having no documentation.

Kevin Pyle added 14 commits June 4, 2014 21:50
Ensure that 'make install' works even if a file named 'install' exists.
Ensure that 'make install' works even if a file named 'install' exists.
Set PLUGIN_NAME from $PYTHON so that multi-Python builds do not collide.
This allows compiling a gcc-python-plugin to run in the context of a
cross-compiler.  Using the cross-compiler to build gcc-python-plugin
would produce a plugin that cannot be loaded on the host system.
Replace "cp && sed -i" with "sed >", so that the file is written with
the desired values on the first pass.  Using a single sed reduces the
number of processes and the number of complete file rewrites.
Use $(MAKE) to run the same make even when it is not named 'make' or is
not first on the path.  Use -C for simplicity, since the Makefile
already relies on GNU make extensions.
When GNU make is given the rule:

    a b: $(DEPS)
	    command

Then for each target that needs an update, command will run.  If a
single run of command generates all the targets, then multiple runs are
at best wasteful and at worst counterproductive if concurrent runs can
corrupt each other's output.
Change generation of print-gcc-version to preprocess, but not compile, a
dummy source file containing the macro GCC_VERSION, then scan the
resulting output to find the numeric value of the macro.  This lets the
compiler do the work of expanding the expression, but avoids running a
test program.  This is necessary for cross-compiler support, since
cross-compiled test outputs cannot be run locally.

Store the output in autogenerated-gcc-version, since it is not a
runnable program.
Rules in gcc-c-api assume the available of
autogenerated-EXTRA_CFLAGS.txt, so ensure it is generated before
recursing into gcc-c-api, even in highly parallel workloads.
Generate to a temporary name, so that a failure in the script does not
leave behind an up-to-date incomplete file.  If the script exits
successfully, then rename the file to its proper name.
Use $(filter-out) to eliminate autogenerated-casts.c from the general
recipe, so that make does not warn when it encounters a specific recipe
for autogenerated-casts.c.
Add a convenience function that knows not to quote the keyword NULL.
Instead of passing the contents of autogenerated-EXTRA_CFLAGS.txt on the
gcc command line, read it in and use it to decide whether to run gcc or
g++.  This also produces a cleaner failure mode if
autogenerated-EXTRA_CFLAGS.txt has an unexpected value.
Rename GCC_VERSION to TARGET_GCC_VERSION in source files.  Add a command
line preprocessor definition setting TARGET_GCC_VERSION to the value of
the file autogenerated-gcc-version, which contains the effective
GCC_VERSION of TARGET_GCC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant