Create a makefile for multiple OS, is this make (ext?) Not working?

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

Now I have a Makefile with the following. The problem is it doesn't create 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 that the Makefile.w32 extension doesn't like it. I don't understand why it doesn't build. Obviously it ends up on my make make.w32 line.

+1


source to share


2 answers


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

make -f Makefile.w32

      

Edit : By the way, why are you running a separate instance of make on the entire target if all you need is "everything" to depend on the target "mingw32" to do the same file? It would be better, IMHO, to declare it as a dependent target:



all: mingw32

      

Likewise "clean" and "mingw32-clean":

clean: mingw32-clean

      

+3


source


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



0


source







All Articles