
I'm trying to add a new utility to the $(TOP)/ghc/utils folder. The utility has a make file, but I can't seem to get it to play nice with GHC's build system. The error I receive is "No rule to make target...". Here's a simple test environment that demonstrates the problem: --------------- 1. Create a new folder called $(TOP)/ghc/utils/testmake. 2. In the 'testmake' folder, create a file named "Makefile" with this content: dir = utils/testmake TOP = ../.. include $(TOP)/mk/sub-makefile.mk 3. In the 'testmake' folder, create a file named "ghc.mk" with this content (NOTE: My email app may have replaced the tab character before "@echo" with spaces.): $(eval $(call all-target,utils/testmake,utils/testmake/dummy_target)) utils/testmake/dummy_target: @echo Hello world! ---------------- Running make results in a "No rule to make target" error: $ make make -C ../.. all_utils/testmake make[1]: Entering directory '/home/ctimmons/ghc' ===--- building phase 0 make --no-print-directory -f ghc.mk phase=0 phase_0_builds make[2]: Nothing to be done for 'phase_0_builds'. ===--- building phase 1 make --no-print-directory -f ghc.mk phase=1 phase_1_builds make[2]: Nothing to be done for 'phase_1_builds'. ===--- building final phase make --no-print-directory -f ghc.mk phase=final all_utils/testmake make[2]: *** No rule to make target 'all_utils/testmake'. Stop. make[1]: *** [Makefile:127: all_utils/testmake] Error 2 make[1]: Leaving directory '/home/ctimmons/ghc' make: *** [../../mk/sub-makefile.mk:50: all] Error 2 However, running ghc.mk directly from the utils/testmake folder does not result in an error: $ make -C ../.. -f utils/testmake/ghc.mk make: Entering directory '/home/ctimmons/ghc' Hello world! make: Leaving directory '/home/ctimmons/ghc' What am I not understanding? Thanks. Chris

"Chris R. Timmons"
I'm trying to add a new utility to the $(TOP)/ghc/utils folder. The utility has a make file, but I can't seem to get it to play nice with GHC's build system. The error I receive is "No rule to make target...".
Here's a simple test environment that demonstrates the problem:
snip
What am I not understanding?
I believe you need to add utils/testmake to the BUILD_SUBDIRS variable in the root ghc.mk. Cheers, - Ben

On 2/23/2018 8:26 AM, Ben Gamari wrote:
"Chris R. Timmons"
writes: I'm trying to add a new utility to the $(TOP)/ghc/utils folder. The utility has a make file, but I can't seem to get it to play nice with GHC's build system. The error I receive is "No rule to make target...".
Here's a simple test environment that demonstrates the problem:
snip
What am I not understanding?
I believe you need to add utils/testmake to the BUILD_SUBDIRS variable in the root ghc.mk.
Cheers,
- Ben
That did the trick. I somehow stumbled upon https://ghc.haskell.org/trac/ghc/wiki/Attic/Building/BuildSystem/New, and was using that as a guide. It looks like I missed reading https://ghc.haskell.org/trac/ghc/wiki/Building/Modifying, where BUILD_DIRS is documented. My bad. Thanks for the quick response. Chris.
participants (2)
-
Ben Gamari
-
Chris R. Timmons