views:

2441

answers:

4

I have a working make, I have platform code and like several makes for each os in the folder. Right now I have one makefile which works. I renamed it to Makefile.ws and wrote this in Makefile

all:
    make -f Makefile.w32

clean:
    make -f Makefile.w32 clean

I ran it and got this error

> "make" 
make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32
make[3]: Makefile.w32: No such file or directory
make[3]: *** No rule to make target `Makefile.w32'.  Stop.
make[2]: *** [all] Error 2
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/nightly/test'
"make": *** [all] Error 2

Oddly enough the clean works perfectly. Then I decided to write "make -f Makefile.w32 mingw32" and that did not work correctly. In fact it made a folder called mingw32 which I thought was very strange.

As for the mingw32 rule I just copy build which I suspect is the main/normal rule that is used to build

$(BUILD):
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

mingw32:
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

full .w32 source is here http://pastie.org/320035

A: 

Have you tried calling the secondary makefile using

$(MAKE) -f ...

instead of

make -f ...?

e.James
+1  A: 

First, what make are you running? Cygwin or MinGW, or something else?

make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32 
make[3]: Makefile.w32: No such file or directory

"Entering directory" is a hint. Why is it entering /c/nightly/test? Is there a Makefile.w32 there?

As to creating the directory "mingw32", the rule

mingw32:
        @[ -d $@ ] || mkdir -p $@
        ...

does exactly that. If "mingw32" does not exist, it creates it.

It would be easier to help you if you had a shorter example and clearly explain what you want to accomplish and what you expect to happen.

JesperE
A: 

I think I see the problem in your second example. The mingw32 line should be changed so that it does not include the $(BUILD) variable:

mingw32:
    @[ -d $@ ] || mkdir -p $@
    @make --no-print-directory -C mingw32 -f $(CURDIR)/Makefile
e.James
A: 
  1. It is clear that he created the directory, your first command in your given 2 rules, include a mkdir with the object name, i.e. either build or mingw32
  2. Afterwards he changes into the current directory (i.e. no cd at all) and execute Makefile. But as you wrote you renamed Makefile into Makefile.ws, so offcourse you are getting File-Not-Found-error.

From the questions I can only recommend you to have a look at an short introduction or even better the manual for make.

flolo