agda / agda

Agda is a dependently typed programming language / interactive theorem prover.
https://wiki.portal.chalmers.se/agda/pmwiki.php
Other
2.39k stars 337 forks source link

makefile hlint target needs cabal_macros.h #7240

Open philderbeast opened 1 month ago

philderbeast commented 1 month ago

Is there a prerequisite missing from the makefile hlint target?

https://github.com/agda/agda/blob/486adef0b8db0d93b076f855574572b4268a1a3f/Makefile#L770

$ git rev-parse HEAD
486adef0b8db0d93b076f855574572b4268a1a3f

$ make hlint
make: *** No rule to make target 'dist-2.6.5-ghc-9.8.2/build/autogen/cabal_macros.h', needed by 'hlint'.  Stop.

$ find -name 'cabal_macros.h'
./dist-newstyle/build/x86_64-linux/ghc-9.8.2/Agda-2.6.5/build/agda-mode/autogen/cabal_macros.h
./dist-newstyle/build/x86_64-linux/ghc-9.8.2/Agda-2.6.5/build/autogen/cabal_macros.h
./dist-newstyle/build/x86_64-linux/ghc-9.8.2/Agda-2.6.5/build/agda/autogen/cabal_macros.h
./dist-newstyle/build/x86_64-linux/ghc-9.8.2/Agda-2.6.5/build/agda-tests/autogen/cabal_macros.h
...

$ BUILD_DIR='dist-newstyle/build/x86_64-linux/ghc-9.8.2/Agda-2.6.5' make hlint
make: *** No rule to make target 'dist-2.6.5-ghc-9.8.2/build/autogen/cabal_macros.h', needed by 'hlint'.  Stop.

$ grep "BUILD_DIR" **/*.md

grep "BUILD_DIR" **/*.mk
...
mk/paths.mk:BUILD_DIR             = $(TOP)/dist-$(VERSION)-ghc-$(GHC_VER)
...

I was able to force the recipe with this change;

$ git diff
diff --git a/mk/paths.mk b/mk/paths.mk
index 6e5367b15..796b773b9 100644
--- a/mk/paths.mk
+++ b/mk/paths.mk
@@ -27,7 +27,7 @@ COMPAT_SRC_DIR = $(SRC_DIR)/compat
 # Andreas, 2020-10-26 further refinement:
 # I often switch GHC version, so indexing v1-style build directories
 # by GHC version x.y.z makes sense.
-BUILD_DIR             = $(TOP)/dist-$(VERSION)-ghc-$(GHC_VER)
+BUILD_DIR            ?= $(TOP)/dist-$(VERSION)-ghc-$(GHC_VER)
 QUICK_BUILD_DIR       = $(BUILD_DIR)-quick
 FAST_BUILD_DIR        = $(BUILD_DIR)-fast
 DEBUG_BUILD_DIR       = $(BUILD_DIR)-debug
$ BUILD_DIR=dist-newstyle/build/x86_64-linux/ghc-9.8.2/Agda-2.6.5 make hlint
hlint --cpp-file=dist-newstyle/build/x86_64-linux/ghc-9.8.2/Agda-2.6.5/build/autogen/cabal_macros.h \
              --cpp-include=./src/full \
      --report=hlint-report.html \
      ./src/full/Agda
Writing report to hlint-report.html ...
No hints