Hesam Qodsi
Hesam Qodsi

Reputation: 1585

guide to mingw make files mingw32-make

I'm a C++ programmer and have experience with GCC on Linux. I want to develop an application in Windows , so i need a full guide to mingw make files, variables and mingw32-make. Is there anybody who can introduce a resource for this?

Upvotes: 8

Views: 45252

Answers (2)

nirvana-msu
nirvana-msu

Reputation: 4077

The main difference I came across is that mingw32-make will use windows PATH. So if you try to run it from git bash it won't behave quite like you expect it to (namely, it will invoke bat scripts when you don't expect it to, and shims also don't quite work).

Setting SHELL := /bin/bash or anything similar won't have any effect (which you can debug by running make -d), but you can still make it use bash instead of sh by setting SHELL := bash.exe. That's doesn't solve the windows PATH problem though.

What I did notice however is that if I additionally set .SHELLFLAGS := -euo pipefail -c then it suddenly behaves properly in git bash, as if it starts using Unix-like paths (would be great if someone could confirm / explain why exactly).

So I ended up with the following in my Makefile:

ifeq ($(OS),Windows_NT)
    SHELL := bash.exe
else
    SHELL := /usr/bin/env bash
endif
.SHELLFLAGS := -eo pipefail -c

With that setup it appears to behave normally in git bash, just like on Linux.

Upvotes: 1

James Kanze
James Kanze

Reputation: 154047

mingw32-make is just a pre-built version of GNU make, so http://www.gnu.org/software/make/manual/ should have all of the information you need.

Upvotes: 9

Related Questions