Skip to content

Commit e85a1a5

Browse files
committed
use magic to fix make -j operation race condition on certain targets
1 parent 7cafb22 commit e85a1a5

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

deps/Makefile

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@ JULIAHOME = $(abspath ..)
33
include Versions.make
44
include $(JULIAHOME)/Make.inc
55

6+
# Special comments:
7+
#
8+
# all targets in here should follow the same structure,
9+
# and provide a get-a, configure-a, compile-a, check-a, and install-a
10+
# additionally all targets should be listed in the getall target for easier off-line compilation
11+
# if you are adding a new target, it can help to copy an similar, existing target
12+
#
13+
# autoconf configure-driven scripts: llvm pcre arpack fftw unwind gmp mpfr patchelf uv
14+
# custom Makefile rules: openlibm Rmath-julia dsfmt suitesparse-wrapper suitesparse lapack openblas mojibake objconv
15+
# CMake libs: libgit2
16+
#
17+
# downloaded from git: llvm-svn, uv, libopenlibm, mojibake, openspecfun
18+
#
19+
# there are rules in this file with the . replaced by a %
20+
# this is some magic Makefile trick that tells make
21+
# that all targets with a % in them on that line will
22+
# be rebuilt in a single invocation
23+
#
24+
25+
## Some shared configuration options ##
26+
627
CONFIGURE_COMMON = --prefix=$(abspath $(build_prefix)) --build=$(BUILD_MACHINE) --libdir=$(abspath $(build_libdir))
728
ifneq ($(XC_HOST),)
829
CONFIGURE_COMMON += --host=$(XC_HOST)
@@ -31,9 +52,8 @@ endif
3152
# they will override the values passed above to ./configure
3253
MAKE_COMMON = DESTDIR="" prefix=$(build_prefix) bindir=$(build_bindir) libdir=$(build_libdir) libexecdir=$(build_libexecdir) datarootdir=$(build_datarootdir) includedir=$(build_includedir) sysconfdir=$(build_sysconfdir)
3354

34-
#autoconf configure-driven scripts: llvm pcre arpack fftw unwind gmp mpfr patchelf uv
35-
#custom Makefile rules: openlibm Rmath-julia dsfmt suitesparse-wrapper suitesparse lapack openblas mojibake objconv
36-
#CMake libs: libgit2
55+
56+
## Overall configuration of which rules exist and should be run by default ##
3757

3858
# prevent installing libs into usr/lib64 on opensuse
3959
unexport CONFIG_SITE
@@ -685,7 +705,7 @@ endif
685705
$(OPENLIBM_OBJ_SOURCE): openlibm/Makefile
686706
$(MAKE) -C openlibm $(OPENLIBM_FLAGS) $(MAKE_COMMON)
687707
touch -c $@
688-
$(OPENLIBM_OBJ_TARGET): $(OPENLIBM_OBJ_SOURCE)
708+
$(build_shlibdir)/libopenlibm%$(SHLIB_EXT) $(build_libdir)/libopenlibm%a : $(OPENLIBM_OBJ_SOURCE)
689709
$(MAKE) -C openlibm install $(OPENLIBM_FLAGS) $(MAKE_COMMON)
690710
$(INSTALL_NAME_CMD)libopenlibm.$(SHLIB_EXT) $(build_shlibdir)/libopenlibm.$(SHLIB_EXT)
691711
touch -c $@
@@ -748,7 +768,7 @@ install-openspecfun: $(OPENSPECFUN_OBJ_TARGET)
748768

749769
## DSFMT ##
750770

751-
DSFMT_OBJ_TARGET = $(build_shlibdir)/libdSFMT.$(SHLIB_EXT)
771+
DSFMT_OBJ_TARGET = $(build_shlibdir)/libdSFMT.$(SHLIB_EXT) $(build_includedir)/dSFMT.h
752772
DSFMT_OBJ_SOURCE = dsfmt-$(DSFMT_VER)/libdSFMT.$(SHLIB_EXT)
753773

754774
DSFMT_CFLAGS = $(CFLAGS) -DNDEBUG -DDSFMT_MEXP=19937 $(fPIC) -DDSFMT_DO_NOT_USE_OLD_NAMES
@@ -774,7 +794,7 @@ dsfmt-$(DSFMT_VER)/config.status: dsfmt-$(DSFMT_VER).tar.gz
774794
$(DSFMT_OBJ_SOURCE): dsfmt-$(DSFMT_VER)/config.status
775795
cd dsfmt-$(DSFMT_VER) && \
776796
$(CC) $(CPPFLAGS) $(DSFMT_CFLAGS) $(LDFLAGS) dSFMT.c -o libdSFMT.$(SHLIB_EXT)
777-
$(DSFMT_OBJ_TARGET): $(DSFMT_OBJ_SOURCE)
797+
$(build_shlibdir)/libdSFMT%$(SHLIB_EXT) $(build_includedir)/dSFMT%h: $(DSFMT_OBJ_SOURCE) | $(build_includedir) $(build_shlibdir)
778798
cp dsfmt-$(DSFMT_VER)/dSFMT.h $(build_includedir)
779799
cp $< $@ && \
780800
$(INSTALL_NAME_CMD)libdSFMT.$(SHLIB_EXT) $(DSFMT_OBJ_TARGET)

0 commit comments

Comments
 (0)