Makefile raises makefile error

I have a working make, I have platform code and how multiple make for each os in a folder. Right now I have one makefile that works. I renamed it 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, cleanliness works great. Then I decided to write "make -f Makefile.w32 mingw32" and it didn't work right. This actually created a folder called mingw32, which I thought was very strange.

Regarding the mingw32 rule, I just copy the assembly, which I suspect is the basic / 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

      

The complete .w32 source is here http://pastie.org/320035

0


source to share


4 answers


First, what are you doing? 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

      

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

Regarding the creation of the "mingw32" directory, the rule



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

      

does just that. If "mingw32" doesn't exist, it creates it.

It would be easier to help you if you had a shorter example and a clear explanation of what you want to accomplish and what you expect.

+1


source


Have you tried using a secondary makefile using

$(MAKE) -f ...



instead

make -f ...

?

0


source


I think I see the problem in the 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
      

0


source


  • It is understood that it created a directory, your first command in your two rules includes mkdir with the object name i.e. either build or mingw32
  • Then it goes to the current directory (i.e. no cd at all) and executes the Makefile. But as you wrote, you renamed the Makefile to Makefile.ws, so you end up with a File-Not-Found error.

For questions, I can only recommend that you take a look at a short introduction or even better manual for make.

0


source







All Articles