GNU make file in ghc/utils folder

Chris R. Timmons chris at crtimmonsinc.com
Fri Feb 23 12:58:35 UTC 2018


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







More information about the ghc-devs mailing list