@@ -3,6 +3,23 @@ include $(JULIAHOME)/Make.inc
33# import LLVM_SHARED_LIB_NAME
44include $(JULIAHOME ) /deps/llvm-ver.make
55
6+ # Make sure the user didn't try to build in a path that will confuse the shell or make
7+ METACHARACTERS := [][?*{}() $$% :;&|!\# ,\\`\":]\|/\./\|/\.\./
8+ ifneq (,$(findstring ',$(value BUILDROOT) ) )
9+ $(error cowardly refusing to build into directory with a single-quote in the path)
10+ endif
11+ ifneq (,$(findstring ',$(value JULIAHOME) ) )
12+ $(error cowardly refusing to build from source directory with a single-quote in the path)
13+ endif
14+ ifneq (,$(shell echo '$(value BUILDROOT) /' | grep '$(METACHARACTERS ) ') )
15+ $(error cowardly refusing to build into directory with a shell-metacharacter in the path\
16+ (got : $(value BUILDROOT) ))
17+ endif
18+ ifneq (,$(shell echo '$(value JULIAHOME) /' | grep '$(METACHARACTERS ) ') )
19+ $(error cowardly refusing to build from source directory with a shell-metacharacter in the path\
20+ (got : $(value JULIAHOME) ))
21+ endif
22+
623VERSDIR := v` cut -d. -f1-2 < $( JULIAHOME) /VERSION `
724
825default : $(JULIA_BUILD_MODE ) # contains either "debug" or "release"
@@ -13,7 +30,7 @@ DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_priva
1330ifneq ($(BUILDROOT ) ,$(JULIAHOME ) )
1431BUILDDIRS := $(BUILDROOT ) $(addprefix $(BUILDROOT ) /,base src src/flisp src/support src/clangsa cli doc deps stdlib test test/clangsa test/embedding test/llvmpasses)
1532BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS ) ) $(BUILDROOT ) /sysimage.mk
16- DIRS := $( DIRS ) $(BUILDDIRS )
33+ DIRS += $(BUILDDIRS )
1734$(BUILDDIRMAKE ) : | $(BUILDDIRS )
1835 @# add Makefiles to the build directories for convenience (pointing back to the source location of each)
1936 @echo ' # -- This file is automatically generated in julia/Makefile -- #' > $@
@@ -44,10 +61,6 @@ $(foreach link,base $(JULIAHOME)/test,$(eval $(call symlink_target,$(link),$$(bu
4461julia_flisp.boot.inc.phony : julia-deps
4562 @$(MAKE ) $(QUIET_MAKE ) -C $(BUILDROOT ) /src julia_flisp.boot.inc.phony
4663
47- # Build the HTML docs (skipped if already exists, notably in tarballs)
48- $(BUILDROOT ) /doc/_build/html/en/index.html : $(shell find $(BUILDROOT ) /base $(BUILDROOT ) /doc \( -path $(BUILDROOT ) /doc/_build -o -path $(BUILDROOT ) /doc/deps -o -name * _constants.jl -o -name * _h.jl -o -name version_git.jl \) -prune -o -type f -print)
49- @$(MAKE ) docs
50-
5164julia-symlink : julia-cli-$(JULIA_BUILD_MODE )
5265ifeq ($(OS ) ,WINNT)
5366 echo '@"%~dp0/'"$$(echo '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')"'" %*' | tr / '\\' > $(BUILDROOT)/julia.bat
@@ -236,7 +249,7 @@ define stringreplace
236249endef
237250
238251
239- install : $(build_depsbindir ) /stringreplace $( BUILDROOT ) /doc/_build/html/en/index.html
252+ install : $(build_depsbindir ) /stringreplace docs
240253 @$(MAKE ) $(QUIET_MAKE ) $(JULIA_BUILD_MODE )
241254 @for subdir in $(bindir ) $(datarootdir ) /julia/stdlib/$(VERSDIR ) $(docdir ) $(man1dir ) $(includedir ) /julia $(libdir ) $(private_libdir ) $(sysconfdir ) $(libexecdir ) ; do \
242255 mkdir -p $(DESTDIR ) $$ subdir; \
484497darwinframework :
485498 $(MAKE ) -C $(JULIAHOME ) /contrib/mac/framework
486499
487- light-source-dist.tmp : $( BUILDROOT ) /doc/_build/html/en/index.html
500+ light-source-dist.tmp : docs
488501ifneq ($(BUILDROOT ) ,$(JULIAHOME ) )
489502 $(error make light-source-dist does not work in out-of-tree builds)
490503endif
@@ -561,12 +574,13 @@ distcleanall: cleanall
561574 @-$(MAKE ) -C $(BUILDROOT ) /deps distcleanall
562575 @-$(MAKE ) -C $(BUILDROOT ) /doc cleanall
563576
564- .PHONY : default debug release check-whitespace release-candidate \
577+ .FORCE :
578+ .PHONY : .FORCE default debug release check-whitespace release-candidate \
565579 julia-debug julia-release julia-stdlib julia-deps julia-deps-libs \
566580 julia-cli-release julia-cli-debug julia-src-release julia-src-debug \
567581 julia-symlink julia-base julia-sysimg julia-sysimg-ji julia-sysimg-release julia-sysimg-debug \
568- test testall testall1 test test- * test-revise- * \
569- clean distcleanall cleanall clean- * \
582+ test testall testall1 test \
583+ clean distcleanall cleanall $( CLEAN_TARGETS ) \
570584 run-julia run-julia-debug run-julia-release run \
571585 install binary-dist light-source-dist.tmp light-source-dist \
572586 dist full-source-dist source-dist
@@ -583,12 +597,12 @@ testall: check-whitespace $(JULIA_BUILD_MODE)
583597testall1 : check-whitespace $(JULIA_BUILD_MODE )
584598 @env JULIA_CPU_THREADS=1 $(MAKE ) $(QUIET_MAKE ) -C $(BUILDROOT ) /test all JULIA_BUILD_MODE=$(JULIA_BUILD_MODE )
585599
586- test-% : check-whitespace $(JULIA_BUILD_MODE )
600+ test-% : check-whitespace $(JULIA_BUILD_MODE ) .FORCE
587601 @ ([ $$ (( $$ (date +% s) - $$ (date - r $(build_private_libdir)/ sys.$(SHLIB_EXT) +% s) )) -le 100 ] && \
588602 printf ' \033[93m HINT The system image was recently rebuilt. Are you aware of the test-revise-* targets? See CONTRIBUTING.md. \033[0m\n' ) || true
589603 @$(MAKE ) $(QUIET_MAKE ) -C $(BUILDROOT ) /test $* JULIA_BUILD_MODE=$(JULIA_BUILD_MODE )
590604
591- test-revise-% :
605+ test-revise-% : .FORCE
592606 @$(MAKE ) $(QUIET_MAKE ) -C $(BUILDROOT ) /test revise-$* JULIA_BUILD_MODE=$(JULIA_BUILD_MODE )
593607
594608# download target for some hardcoded windows dependencies
0 commit comments