Skip to content

Parallel make issue #394

Description

@osresearch

I think our parallel make issue might be a Make bug, rather than a makefile bug. Here's a minimal test case inspired by this answer https://stackoverflow.com/a/47951465 :

all: e
.INTERMEDIATE: d

e: a b c
    cat $^ > $@
a b c: d
d: i1 i2
    cat i1 i2 > a
    cat i1 i2 > b
    cat i1 i2 > c

i1 i2:
    touch $@

In a single threaded make this does the right thing. it creates i1 and i2, then cats them to make a b and c, then cats a b c to make e.

/tmp: make
touch i1
touch i2
cat i1 i2 > a
cat i1 i2 > b
cat i1 i2 > c
cat a b c > e

If e doesn't exist, it is recreated correctly in a parallel make:

/tmp: rm i1 i2 e a b c
/tmp: make -j4
touch i1
touch i2
cat i1 i2 > a
cat i1 i2 > b
cat i1 i2 > c
cat a b c > e

But if e already exists, make will regenerate a, b, and c, but not update e on the first run. It does recreate e on a second run:

/tmp: rm i1 i2
/tmp: make -j4
touch i1
touch i2
cat i1 i2 > a
cat i1 i2 > b
cat i1 i2 > c
/tmp: make -j4
cat a b c > e

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions