Repository navigation
Generate valgrind/fjalar/Makefile.am from Memcheck's #113
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
Open
mernst
wants to merge
10
commits into
codespecs:master
Choose a base branch
from
mernst:generate-fjalar-makefile
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
bb607f7
Generate valgrind/fjalar/Makefile.am from Memcheck's
mernst 1026663
Use MOSTLYCLEANFILES for the stamp; clarify the generator's exit status
mernst d962317
Valgrind plan, step 6: run generate-fjalar-makefile.sh by its absolut…
mernst 56e2000
Merge remote-tracking branch 'upstream/master' into generate-fjalar-m…
mernst e44758a
Merge doc: set DAIKONDIR when cloning, explain removing memcheck file…
mernst dd45210
Merge branch 'master' into generate-fjalar-makefile
mernst 5a4ec06
Fjalar manual: to create a tool, edit fjalar.am, not the generated Ma…
mernst ee4b2c1
Revert the merge doc changes of e44758a, which are unrelated to gener…
mernst 1577c74
generate-fjalar-makefile.sh: a change to fjalar.am needs only automake
mernst fc34e6d
generate-fjalar-makefile.sh: create the temporary file with mktemp
mernst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #!/bin/bash | ||
|
|
||
| # This script generates Fjalar's build file valgrind/fjalar/Makefile.am from | ||
| # Memcheck's, valgrind/memcheck/Makefile.am, by renaming Memcheck to Fjalar. | ||
| # Fjalar's changes to the build are in valgrind/fjalar/fjalar.am, which the | ||
| # generated file includes. Run this script after the Memcheck merge (see | ||
| # doc/valgrind-merge.texinfo), and after changing this script. A change to | ||
| # fjalar.am needs only a rerun of automake, such as by auto-everything.sh, | ||
| # because the generated file includes fjalar.am. | ||
| # Usage: generate-fjalar-makefile.sh [OUTPUT] | ||
| # OUTPUT defaults to valgrind/fjalar/Makefile.am. If any line of the | ||
| # generated file may need a change to the renaming, the script prints each | ||
| # such line and exits with status 2. Otherwise it exits with status 0, or | ||
| # with status 1 if it fails. | ||
|
|
||
| set -e | ||
| set -o pipefail | ||
| # A failing command, such as sed, may itself exit with status 2. | ||
| trap 'exit 1' ERR | ||
|
|
||
| top=$(dirname "$0") | ||
| output=${1:-$top/valgrind/fjalar/Makefile.am} | ||
| # Write to a temporary file, so that a failure leaves OUTPUT unchanged. mktemp | ||
| # creates it exclusively, with an unpredictable name. | ||
| tmp=$(mktemp "$output.XXXXXX") | ||
| trap 'rm -f "$tmp"' EXIT | ||
|
|
||
| # Fjalar's version is generated instead of patched, because almost every | ||
| # line of it renames Memcheck to Fjalar, so most upstream changes would | ||
| # conflict. Fjalar builds every Memcheck source file. | ||
| # The sed command renames only Memcheck's program and variable names, not | ||
| # file names such as memcheck.h, and it removes the assignment, including | ||
| # its continuation lines, that adds Memcheck's docs, which Fjalar lacks, to | ||
| # EXTRA_DIST. | ||
| { | ||
| echo "## Generated by generate-fjalar-makefile.sh from ../memcheck/Makefile.am." | ||
| echo "## Do not edit this file; put Fjalar's changes in fjalar.am." | ||
| echo | ||
| sed -e 's/memcheck\([-_]\)/fjalar\1/g; s/MEMCHECK_/FJALAR_/g' \ | ||
| -e '/^EXTRA_DIST *= *docs\//{:a;/\\$/{N;ba};d}' \ | ||
| "$top/valgrind/memcheck/Makefile.am" | ||
| echo | ||
| echo 'include $(srcdir)/fjalar.am' | ||
| } > "$tmp" | ||
| # mktemp creates the file readable only by its owner; give it the usual | ||
| # permissions, as a plain redirection would. | ||
| chmod "$(printf '%o' $((0666 & ~0$(umask))))" "$tmp" | ||
| mv "$tmp" "$output" | ||
|
|
||
| # An upstream change that the renaming does not handle needs a change to | ||
| # this script. Conflict markers mean that the Coregrind merge left | ||
| # valgrind/memcheck/Makefile.am unresolved. Each memcheck.h is removed | ||
| # before the check, so that the rest of its line is still checked. | ||
| problems=$(awk '/^##/ { next } | ||
| { line = tolower($0); gsub(/memcheck\.h/, "", line) } | ||
| line ~ /memcheck|docs\// || /^(<<<<<<<|\|\|\|\|\|\|\||=======|>>>>>>>)/ { print FNR ":" $0 }' "$output") | ||
| if [ -n "$problems" ]; then | ||
| echo "Lines of $output that may need a change to the renaming" | ||
| echo "in $0 or a resolution of a conflict:" | ||
| echo "$problems" | ||
| exit 2 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.