简体   繁体   中英

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?

mingw32-make只是 GNU make 的预构建版本,因此http://www.gnu.org/software/make/manual/应该包含您需要的所有信息。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM