views:

476

answers:

2

I have a working makefile that builds with mingw32. Now i renamed that makefile to Makefile.w32 (source -> http://pastie.org/319964)

Now i have a Makefile with the following. The problem is, it does not build my source

all:
    make mingw32

clean:
    @echo "causes an infinite loop -> make mingw32 clean"

mingw32:
    @echo "yeahhhhhhhhh"
    make Makefile.w32

mingw32-clean:
    @echo "mingw clean"
    make Makefile.w32 clean

result:

> "make" 
make mingw32
make[1]: Entering directory `/c/nightly/test'
yeahhhhhhhhh
make Makefile.w32
make[2]: Entering directory `/c/nightly/test'
make[2]: Nothing to be done for `Makefile.w32'.
make[2]: Leaving directory `/c/nightly/test'
make[1]: Leaving directory `/c/nightly/test'

It seems to me it doesn't like Makefile.w32 extension. I dont understand why it isn't building. It;s obviously getting to my "make Makefile.w32" line.

+3  A: 

"make Makefile.w32" is looking for a target named Makefile.w32, not a make file by that name. To run make and tell it to read the make file "Makefile.w32", use the -f switch:

make -f Makefile.w32

Edit: Incidentally, why do you launch a separate instance of make in the "all" target, if all you want is for "all" to depend on the "mingw32" target in the same make file? It'd be better, IMHO, to declare it as a dependent target instead:

all: mingw32

Likewise with "clean" and "mingw32-clean":

clean: mingw32-clean
Sherm Pendley
A: 

You can use cmake to generate makefiles. It should work on most platforms.

Jason Baker