makefile: uname osx fix & detect MinGW & MSYS

pull/1866/head
joe-conigliaro 2019-09-05 02:49:11 +10:00 committed by Alexander Medvednikov
parent 2ae2ede06a
commit a0b3d0809d
1 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,10 @@
CC ?= cc CC ?= cc
_SYS:=$(shell uname -o) _SYS := $(shell uname 2>/dev/null || echo Unknown)
ifeq ($(_SYS),Msys) _SYS := $(patsubst MSYS%,MSYS,$(_SYS))
_SYS := $(patsubst MINGW%,MinGW,$(_SYS))
ifneq ($(filter $(_SYS),MSYS MinGW),)
WIN32:=1 WIN32:=1
endif endif
@ -9,10 +12,10 @@ all:
rm -rf vc/ rm -rf vc/
git clone --depth 1 --quiet https://github.com/vlang/vc git clone --depth 1 --quiet https://github.com/vlang/vc
ifdef WIN32 ifdef WIN32
${CC} -std=gnu11 -DUNICODE -D_UNICODE -w -o v0.exe vc/v_win.c $(CC) -std=gnu11 -DUNICODE -D_UNICODE -w -o v0.exe vc/v_win.c
./v0.exe -o v.exe compiler ./v0.exe -o v.exe compiler
else else
${CC} -std=gnu11 -w -o v vc/v.c -lm $(CC) -std=gnu11 -w -o v vc/v.c -lm
./v -o v compiler ./v -o v compiler
endif endif
rm -rf vc/ rm -rf vc/