Skip to content

Commit e0b69fa

Browse files
committed
makefile: Simpler build under MinGW. Detect attempt to build under Msys bash shell and issue error message
1 parent 30d2db2 commit e0b69fa

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

build_mingw.bat

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ rem Individual simulator sources are in .\simulator_name
1010
rem Individual simulator executables are to .\BIN
1111
rem
1212
rem If needed, define the path for the MINGW bin directory.
13-
rem (this should already be set if MINGW was installed correctly)
1413
rem
1514
gcc -v 1>NUL 2>NUL
1615
if ERRORLEVEL 1 path C:\MinGW\bin;%path%
1716
if not exist BIN mkdir BIN
1817
gcc -v 1>NUL 2>NUL
1918
if ERRORLEVEL 1 echo "MinGW Environment Unavailable"
20-
mingw32-make WIN32=1 -f makefile %*
19+
mingw32-make -f makefile %*

build_mingw_noasync.bat

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ rem Individual simulator sources are in .\simulator_name
55
rem Individual simulator executables are to .\BIN
66
rem
77
rem If needed, define the path for the MINGW bin directory.
8-
rem (this should already be set if MINGW was installed correctly)
98
rem
109
gcc -v 1>NUL 2>NUL
1110
if ERRORLEVEL 1 path C:\MinGW\bin;%path%
1211
if not exist BIN mkdir BIN
1312
gcc -v 1>NUL 2>NUL
1413
if ERRORLEVEL 1 echo "MinGW Environment Unavailable"
15-
mingw32-make WIN32=1 NOASYNCH=1 -f makefile %*
14+
mingw32-make NOASYNCH=1 -f makefile %*

makefile

+11
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ else
8787
endif
8888
find_lib = $(abspath $(strip $(firstword $(foreach dir,$(strip $(LIBPATH)),$(wildcard $(dir)/lib$(1).$(LIBEXT))))))
8989
find_include = $(abspath $(strip $(firstword $(foreach dir,$(strip $(INCPATH)),$(wildcard $(dir)/$(1).h)))))
90+
ifneq ($(findstring Windows,$(OS)),)
91+
ifeq ($(findstring .exe,$(SHELL))),.exe)
92+
# MinGW
93+
WIN32 := 1
94+
else # Msys or cygwin
95+
ifeq (MINGW,$(findstring MINGW,$(shell uname)))
96+
$(info *** This makefile can not be used with the Msys bash shell)
97+
$(error *** Use build_mingw.bat $(MAKECMDGOALS) from a Windows command prompt)
98+
endif
99+
endif
100+
endif
90101
ifeq ($(WIN32),) #*nix Environments (&& cygwin)
91102
ifeq ($(GCC),)
92103
ifeq (,$(shell which gcc 2>/dev/null))

0 commit comments

Comments
 (0)