Skip to content

Commit

Permalink
Makefile: fix lib rule
Browse files Browse the repository at this point in the history
When the rule for dynamic library is run in parallel (using make -jX),
it can overwrite one file multiple times resulting in errors like:
build/dynamic/lib/libminisat.so: file not recognized: File format not recognized

Fix it by splitting and making an explicit dependency in Makefile.

Signed-off-by: Jiri Slaby <[email protected]>
  • Loading branch information
Jiri Slaby committed Oct 11, 2015
1 parent 37dc6c6 commit b5c64c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ $(BUILD_DIR)/release/bin/$(MINISAT_CORE) $(BUILD_DIR)/debug/bin/$(MINISAT_CORE)
$(VERB) $(AR) -rcs $@ $^

## Shared Library rule
$(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)\
$(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR)\
$(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB):
$(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE):
$(ECHO) Linking Shared Library: $@
$(VERB) mkdir -p $(dir $@)
$(VERB) $(CXX) $(MINISAT_LDFLAGS) $(LDFLAGS) -o $@ -shared -Wl,-soname,$(MINISAT_DLIB).$(SOMAJOR) $^

$(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR): $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)
$(VERB) ln -sf $(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE) $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR)

$(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB): $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR)
$(VERB) ln -sf $(MINISAT_DLIB).$(SOMAJOR) $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB)

install: install-headers install-lib install-bin
Expand Down

0 comments on commit b5c64c1

Please sign in to comment.