Skip to content

Commit 6b0f7de

Browse files
authored
Move .PHONY statements in Makefiles and add missing ones (#60075)
This moves most `.PHONY` statements in our `Makefile`s next to the target they are marking as phony. This then makes it easy to spot those targets which clearly should be marked as phony but aren't. Subsequently this is then resolved. Also some `.PHONY` statements for targets that do not exist anymore are also removed.
1 parent 36ea5ce commit 6b0f7de

File tree

8 files changed

+134
-19
lines changed

8 files changed

+134
-19
lines changed

Makefile

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ endif
2222

2323
VERSDIR := v`cut -d. -f1-2 < $(JULIAHOME)/VERSION`
2424

25+
.PHONY: default
2526
default: $(JULIA_BUILD_MODE) # contains either "debug" or "release"
27+
28+
.PHONY: all
2629
all: debug release
2730

2831
# sort is used to remove potential duplicates
@@ -65,6 +68,7 @@ julia_flisp.boot.inc.phony: julia-deps
6568
$(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)
6669
@$(MAKE) docs
6770

71+
.PHONY: julia-symlink
6872
julia-symlink: julia-cli-$(JULIA_BUILD_MODE)
6973
ifeq ($(OS),WINNT)
7074
printf '@"%%~dp0/%s" %%*\n' "$$(printf "%s\n" '$(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE))')" | tr / '\\' > $(BUILDROOT)/julia.bat
@@ -82,13 +86,16 @@ TOP_LEVEL_PKG_LINK_TARGETS := $(addprefix $(build_datarootdir)/julia/,$(TOP_LEVE
8286
# Generate symlinks for top level pkgs in usr/share/julia/
8387
$(foreach module, $(TOP_LEVEL_PKGS), $(eval $(call symlink_target,$$(JULIAHOME)/$(module),$$(build_datarootdir)/julia,$(module))))
8488

89+
.PHONY: julia-deps
8590
julia-deps: | $(DIRS) $(build_datarootdir)/julia/base $(build_datarootdir)/julia/test
8691
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/deps
8792

8893
# `julia-stdlib` depends on `julia-deps` so that the fake JLL stdlibs can copy in their Artifacts.toml files.
94+
.PHONY: julia-stdlib
8995
julia-stdlib: | $(DIRS) julia-deps
9096
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/stdlib
9197

98+
.PHONY: julia-base
9299
julia-base: julia-deps $(build_sysconfdir)/julia/startup.jl $(build_man1dir)/julia.1 $(build_datarootdir)/julia/julia-config.jl $(build_datarootdir)/julia/juliac/juliac.jl $(build_datarootdir)/julia/juliac/abi_export.jl $(build_datarootdir)/julia/juliac/juliac-buildscript.jl $(build_datarootdir)/julia/juliac/juliac-trim-base.jl $(build_datarootdir)/julia/juliac/juliac-trim-stdlib.jl $(build_datarootdir)/julia/juliac/Artifacts.toml
93100
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/base
94101

@@ -104,33 +111,43 @@ julia-libccalllazybar: julia-deps julia-libccalllazyfoo
104111
julia-libllvmcalltest: julia-deps
105112
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src libllvmcalltest
106113

114+
.PHONY: julia-src-release julia-src-debug
107115
julia-src-release julia-src-debug : julia-src-% : julia-deps julia_flisp.boot.inc.phony julia-cli-%
108116
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src $*
109117

118+
.PHONY: julia-cli-release julia-cli-debug
110119
julia-cli-release julia-cli-debug: julia-cli-% : julia-deps
111120
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/cli $*
112121

122+
.PHONY: julia-sysimg-release julia-sysimg-debug
113123
julia-sysimg-release julia-sysimg-debug : julia-sysimg-% : julia-src-% $(TOP_LEVEL_PKG_LINK_TARGETS) julia-stdlib julia-base julia-cli-% | $(build_private_libdir)
114124
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-$*
115125

116126
# Useful for cross-bootstrapping
127+
.PHONY: julia-sysbase-release julia-sysbase-debug
117128
julia-sysbase-release julia-sysbase-debug : julia-sysbase-% : julia-src-% $(TOP_LEVEL_PKG_LINK_TARGETS) julia-stdlib julia-base julia-cli-% | $(build_private_libdir)
118129
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysbase-$*
119130

131+
.PHONY: julia-debug julia-release
120132
julia-debug julia-release : julia-% : julia-sysimg-% julia-src-% julia-symlink julia-libccalltest \
121133
julia-libccalllazyfoo julia-libccalllazybar julia-libllvmcalltest julia-base-cache
122134

135+
.PHONY: stdlibs-cache-release stdlibs-cache-debug
123136
stdlibs-cache-release stdlibs-cache-debug : stdlibs-cache-% : julia-%
124137
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f pkgimage.mk $*
125138

139+
.PHONY: debug release
126140
debug release : % : julia-% stdlibs-cache-%
127141

142+
.PHONY: docs
128143
docs: julia-sysimg-$(JULIA_BUILD_MODE) stdlibs-cache-$(JULIA_BUILD_MODE)
129144
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/doc JULIA_EXECUTABLE='$(call spawn,$(JULIA_EXECUTABLE_$(JULIA_BUILD_MODE))) --startup-file=no'
130145

146+
.PHONY: docs-revise
131147
docs-revise:
132148
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/doc JULIA_EXECUTABLE='$(call spawn,$(JULIA_EXECUTABLE_$(JULIA_BUILD_MODE))) --startup-file=no' revise=true
133149

150+
.PHONY: check-whitespace
134151
check-whitespace:
135152
ifneq ($(NO_GIT), 1)
136153
@# Append the directory containing the julia we just built to the end of `PATH`,
@@ -140,6 +157,7 @@ else
140157
$(warn "Skipping whitespace check because git is unavailable")
141158
endif
142159

160+
.PHONY: fix-whitespace
143161
fix-whitespace:
144162
ifneq ($(NO_GIT), 1)
145163
@# Append the directory containing the julia we just built to the end of `PATH`,
@@ -149,6 +167,7 @@ else
149167
$(warn "Skipping whitespace fix because git is unavailable")
150168
endif
151169

170+
.PHONY: release-candidate
152171
release-candidate: release testall
153172
@$(JULIA_EXECUTABLE) $(JULIAHOME)/contrib/add_license_to_files.jl #add license headers
154173
@#Check documentation
@@ -203,6 +222,7 @@ $(build_datarootdir)/julia/%: $(JULIAHOME)/contrib/% | $(build_datarootdir)/juli
203222
$(build_depsbindir)/stringreplace: $(JULIAHOME)/contrib/stringreplace.c | $(build_depsbindir)
204223
@$(call PRINT_CC, $(HOSTCC) -o $(build_depsbindir)/stringreplace $(JULIAHOME)/contrib/stringreplace.c)
205224

225+
.PHONY: julia-base-cache
206226
julia-base-cache: julia-sysimg-$(JULIA_BUILD_MODE) | $(DIRS) $(build_datarootdir)/julia
207227
@JULIA_BINDIR=$(call cygpath_w,$(build_bindir)) JULIA_FALLBACK_REPL=1 WINEPATH="$(call cygpath_w,$(build_bindir));$$WINEPATH" \
208228
$(call spawn, $(JULIA_EXECUTABLE) --startup-file=no $(call cygpath_w,$(JULIAHOME)/contrib/write_base_cache.jl) \
@@ -325,6 +345,7 @@ define stringreplace
325345
endef
326346

327347

348+
.PHONY: install
328349
install: $(build_depsbindir)/stringreplace $(BUILDROOT)/doc/_build/html/en/index.html
329350
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
330351
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
@@ -571,6 +592,7 @@ endif
571592
distclean:
572593
-rm -fr $(BUILDROOT)/julia-*.tar.gz $(BUILDROOT)/julia*.exe $(BUILDROOT)/julia-$(JULIA_COMMIT)
573594

595+
.PHONY: binary-dist
574596
binary-dist: distclean
575597
ifeq ($(USE_SYSTEM_BLAS),0)
576598
ifeq ($(ISX86),1)
@@ -617,6 +639,7 @@ app:
617639
darwinframework:
618640
$(MAKE) -C $(JULIAHOME)/contrib/mac/framework
619641

642+
.PHONY: light-source-dist.tmp
620643
light-source-dist.tmp: $(BUILDROOT)/doc/_build/html/en/index.html
621644
ifneq ($(BUILDROOT),$(JULIAHOME))
622645
$(error make light-source-dist does not work in out-of-tree builds)
@@ -639,6 +662,7 @@ endif
639662
find doc/_build/html >> light-source-dist.tmp
640663

641664
# Make tarball with only Julia code + stdlib tarballs
665+
.PHONY: light-source-dist
642666
light-source-dist: light-source-dist.tmp
643667
# Prefix everything with "julia-$(commit-sha)/" or "julia-$(version)/" and then create tarball
644668
# To achieve prefixing, we temporarily create a symlink in the source directory that points back
@@ -648,10 +672,12 @@ light-source-dist: light-source-dist.tmp
648672
tar -cz --no-recursion -T light-source-dist.tmp1 -f julia-$(JULIA_VERSION)_$(JULIA_COMMIT).tar.gz
649673
rm julia-${JULIA_COMMIT}
650674

675+
.PHONY: source-dist
651676
source-dist:
652677
@echo \'source-dist\' target is deprecated: use \'full-source-dist\' instead.
653678

654679
# Make tarball with Julia code plus all dependencies
680+
.PHONY: full-source-dist
655681
full-source-dist: light-source-dist.tmp
656682
# Get all the dependencies downloaded
657683
@$(MAKE) -C deps getall DEPS_GIT=0 USE_BINARYBUILDER=0
@@ -668,6 +694,7 @@ full-source-dist: light-source-dist.tmp
668694
tar -cz --no-recursion -T full-source-dist.tmp1 -f julia-$(JULIA_VERSION)_$(JULIA_COMMIT)-full.tar.gz
669695
rm julia-${JULIA_COMMIT}
670696

697+
.PHONY: clean
671698
clean: | $(CLEAN_TARGETS)
672699
@-$(MAKE) -C $(BUILDROOT)/base clean
673700
@-$(MAKE) -C $(BUILDROOT)/doc clean
@@ -685,41 +712,40 @@ clean: | $(CLEAN_TARGETS)
685712
# Teporarily add this line to the Makefile to remove extras
686713
-rm -fr $(build_datarootdir)/julia/extras
687714

715+
.PHONY: cleanall
688716
cleanall: clean
689717
@-$(MAKE) -C $(BUILDROOT)/src clean-flisp clean-support
690718
@-$(MAKE) -C $(BUILDROOT)/deps clean-libuv
691719
-rm -fr $(build_prefix) $(build_staging)
692720

721+
.PHONY: distcleanall
693722
distcleanall: cleanall
694723
@-$(MAKE) -C $(BUILDROOT)/stdlib distclean
695724
@-$(MAKE) -C $(BUILDROOT)/deps distcleanall
696725
@-$(MAKE) -C $(BUILDROOT)/doc cleanall
697726

698727
.FORCE:
699-
.PHONY: .FORCE default debug release check-whitespace fix-whitespace release-candidate \
700-
julia-debug julia-release julia-stdlib julia-deps julia-deps-libs \
701-
julia-cli-release julia-cli-debug julia-src-release julia-src-debug \
702-
julia-symlink julia-base julia-sysimg julia-sysimg-ji julia-sysimg-release julia-sysimg-debug \
703-
test testall testall1 test \
704-
clean distcleanall cleanall $(CLEAN_TARGETS) \
705-
run-julia run-julia-debug run-julia-release run \
706-
install binary-dist light-source-dist.tmp light-source-dist \
707-
dist full-source-dist source-dist \
708-
compile-database
728+
.PHONY: .FORCE
729+
730+
.PHONY: $(CLEAN_TARGETS)
709731

710732
# Generate compilation database (leverages existing clang tooling setup)
733+
.PHONY: compile-database
711734
compile-database:
712735
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src compile-database
713736

737+
.PHONY: test
714738
test: check-whitespace $(JULIA_BUILD_MODE)
715739
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test default JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
716740

741+
.PHONY: testall
717742
testall: check-whitespace $(JULIA_BUILD_MODE)
718743
cp $(JULIA_SYSIMG) $(BUILDROOT)/local.$(SHLIB_EXT)
719744
$(call spawn,$(JULIA_EXECUTABLE) -J $(call cygpath_w,$(BUILDROOT)/local.$(SHLIB_EXT)) -e 'true')
720745
rm $(BUILDROOT)/local.$(SHLIB_EXT)
721746
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test all JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
722747

748+
.PHONY: testall1
723749
testall1: check-whitespace $(JULIA_BUILD_MODE)
724750
@env JULIA_CPU_THREADS=1 $(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test all JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
725751

@@ -732,7 +758,7 @@ test-revise-%: .FORCE
732758
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/test revise-$* JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
733759

734760
# download target for some hardcoded windows dependencies
735-
.PHONY: win-extras wine_path
761+
.PHONY: win-extras
736762
win-extras:
737763
@$(MAKE) -C $(BUILDROOT)/deps install-p7zip
738764
mkdir -p $(JULIAHOME)/dist-extras

deps/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,22 @@ distcleanall: $(addprefix distclean-, $(DEP_LIBS_ALL))
247247
rm -rf $(build_prefix)
248248
getall: $(addprefix get-, $(DEP_LIBS_ALL))
249249

250+
.PHONY: default
251+
.PHONY: get
252+
.PHONY: extract
253+
.PHONY: configure
254+
.PHONY: compile
255+
.PHONY: check
256+
.PHONY: fastcheck
257+
.PHONY: stage
258+
.PHONY: install
259+
.PHONY: version-check
260+
261+
.PHONY: uninstall
262+
.PHONY: cleanall
263+
.PHONY: distcleanall
264+
.PHONY: getall
265+
250266
include $(SRCDIR)/BOLT.mk
251267
include $(SRCDIR)/csl.mk
252268
include $(SRCDIR)/sanitizers.mk

deps/mmtk_julia.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MMTK_VARS := MMTK_PLAN=$(MMTK_PLAN) MMTK_MOVING=$(MMTK_MOVING)
99
ifneq ($(USE_BINARYBUILDER_MMTK_JULIA),1)
1010
$(eval $(call git-external,mmtk_julia,MMTK_JULIA,,,$(BUILDDIR)))
1111
get-mmtk_julia: $(MMTK_JULIA_SRC_FILE)
12+
.PHONY: get-mmtk_julia
1213

1314
# Download the binding, build it from source
1415
ifeq (${MMTK_JULIA_DIR},$(BUILDROOT)/usr/lib/mmtk_julia)
@@ -33,6 +34,12 @@ compile-mmtk_julia: $(BUILDROOT)/usr/lib/libmmtk_julia.so
3334
fastcheck-mmtk_julia: #none
3435
check-mmtk_julia: compile-mmtk_julia
3536

37+
.PHONY: extract-mmtk_julia
38+
.PHONY: configure-mmtk_julia
39+
.PHONY: compile-mmtk_julia
40+
.PHONY: fastcheck-mmtk_julia
41+
.PHONY: check-mmtk_julia
42+
3643
$(eval $(call symlink_install,mmtk_julia,$$(MMTK_JULIA_SRC_DIR),$$(BUILDROOT)/usr/lib))
3744

3845
# In this case, there is a custom version of the binding in MMTK_JULIA_DIR
@@ -42,10 +49,13 @@ else
4249
PROJECT_DIRS := JULIA_PATH=$(JULIAHOME) JULIA_BUILDROOT=$(BUILDROOT) MMTK_JULIA_DIR=$(MMTK_JULIA_DIR)
4350
MMTK_JULIA_LIB_PATH=$(MMTK_JULIA_DIR)/mmtk/target/$(MMTK_BUILD)
4451

52+
.PHONY: install-mmtk_julia
4553
install-mmtk_julia: compile-mmtk_julia $(build_prefix)/manifest/mmtk_julia
4654

55+
.PHONY: compile-mmtk_julia
4756
compile-mmtk_julia: $(BUILDROOT)/usr/lib/libmmtk_julia.so
4857

58+
.PHONY: version-check-mmtk_julia
4959
version-check-mmtk_julia: $(MMTK_JULIA_DIR)/mmtk/target/$(MMTK_BUILD)/libmmtk_julia.so
5060

5161
# NB: This will NOT run `cargo build` if there are changes in the Rust source files
@@ -62,6 +72,7 @@ MMTK_JULIA_VER := mmtk_julia_custom
6272
UNINSTALL_mmtk_julia := $(MMTK_JULIA_VER) manual_mmtk_julia
6373

6474
define manual_mmtk_julia
75+
.PHONY: uninstall-mmtk_julia
6576
uninstall-mmtk_julia:
6677
-rm -f $(build_prefix)/manifest/mmtk_julia
6778
-rm -f $(BUILDROOT)/usr/lib/libmmtk_julia.so
@@ -91,6 +102,7 @@ else
91102
LIB_PATH_MOVING := moving
92103
endif
93104

105+
.PHONY: version-check-mmtk_julia
94106
version-check-mmtk_julia: $(BUILDROOT)/usr/lib/libmmtk_julia.so
95107

96108
$(BUILDROOT)/usr/lib/libmmtk_julia.so: get-mmtk_julia

deps/tools/common.mk

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,26 @@ endif
289289

290290
## phony targets ##
291291

292-
.PHONY: default get extract configure compile fastcheck check install uninstall reinstall cleanall distcleanall version-check \
293-
get-* extract-* configure-* compile-* fastcheck-* check-* install-* uninstall-* reinstall-* clean-* distclean-* \
294-
update-llvm
292+
.PHONY: check
293+
.PHONY: check-*
294+
.PHONY: clean-*
295+
.PHONY: cleanall
296+
.PHONY: compile
297+
.PHONY: compile-*
298+
.PHONY: configure
299+
.PHONY: configure-*
300+
.PHONY: default
301+
.PHONY: distclean-*
302+
.PHONY: distcleanall
303+
.PHONY: extract
304+
.PHONY: extract-*
305+
.PHONY: fastcheck
306+
.PHONY: fastcheck-*
307+
.PHONY: get
308+
.PHONY: get-*
309+
.PHONY: install
310+
.PHONY: install-*
311+
.PHONY: reinstall
312+
.PHONY: reinstall-*
313+
.PHONY: uninstall
314+
.PHONY: uninstall-*

doc/Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Makefile for building documentation
22

3+
.PHONY: default
34
default: html
45

56
# You can set these variables from the command line.
@@ -9,8 +10,7 @@ SRCCACHE := $(abspath $(JULIAHOME)/deps/srccache)
910
include $(JULIAHOME)/Make.inc
1011
JULIA_EXECUTABLE := $(call spawn,$(build_bindir)/julia) --startup-file=no
1112

12-
.PHONY: help clean cleanall html pdf deps deploy
13-
13+
.PHONY: help
1414
help:
1515
@echo "Please use 'make <target>' where <target> is one of"
1616
@echo " html to make standalone HTML files"
@@ -35,39 +35,49 @@ DOC_FILES=$(filter-out NEWS.md stdlib,$(notdir $(wildcard $(SRCDIR)/src/*)))
3535
src/%:
3636
@mkdir -p src
3737
ln -s $(SRCDIR)/src/$* $@
38+
.PHONY: src
3839
src: $(addprefix src/,$(DOC_FILES))
3940

41+
.PHONY: deps
4042
deps: $(SRCCACHE)/UnicodeData-$(UNICODE_DATA_VERSION).txt
4143
$(JLCHECKSUM) "$<"
4244
cp "$<" UnicodeData.txt
4345

46+
.PHONY: alldeps
4447
alldeps: deps
4548
$(JULIA_EXECUTABLE) --color=yes $(call cygpath_w,$(SRCDIR)/make.jl) deps $(DOCUMENTER_OPTIONS)
4649

50+
.PHONY: checksum-unicodedata
4751
checksum-unicodedata: $(SRCCACHE)/UnicodeData-$(UNICODE_DATA_VERSION).txt
4852
$(JLCHECKSUM) "$<"
4953

54+
.PHONY: clean
5055
clean:
5156
rm -rf _build/* deps/* docbuild.log UnicodeData.txt
5257

58+
.PHONY: cleanall
5359
cleanall: clean
5460

61+
.PHONY: html
5562
html: deps
5663
@echo "Building HTML documentation."
5764
$(JULIA_EXECUTABLE) --color=yes $(call cygpath_w,$(SRCDIR)/make.jl) $(DOCUMENTER_OPTIONS)
5865
@echo "Build finished. The HTML pages are in _build/html."
5966

67+
.PHONY: pdf
6068
pdf: deps
6169
@echo "Building PDF documentation."
6270
$(JULIA_EXECUTABLE) --color=yes $(call cygpath_w,$(SRCDIR)/make.jl) -- pdf $(DOCUMENTER_OPTIONS)
6371
@echo "Build finished."
6472

6573
# The deploy target should only be called in CI builds
74+
.PHONY: deploy
6675
deploy: deps
6776
@echo "Deploying HTML documentation."
6877
$(JULIA_EXECUTABLE) --color=yes $(call cygpath_w,$(SRCDIR)/make.jl) -- deploy $(DOCUMENTER_OPTIONS)
6978
@echo "Build & deploy of docs finished."
7079

80+
.PHONY: update-documenter
7181
update-documenter:
7282
@echo "Updating Documenter."
7383
JULIA_PKG_PRECOMPILE_AUTO=0 $(JULIA_EXECUTABLE) --project=$(call cygpath_w,$(SRCDIR)/../deps/jlutilities/documenter/) --color=yes -e 'using Pkg; Pkg.update("Documenter")'

0 commit comments

Comments
 (0)