Skip to content

Instantly share code, notes, and snippets.

@thehydroimpulse
Created September 28, 2012 01:31
Show Gist options
  • Save thehydroimpulse/3797472 to your computer and use it in GitHub Desktop.
Save thehydroimpulse/3797472 to your computer and use it in GitHub Desktop.
OS Check
ifneq (,$(findstring /cygdrive/,$(PATH)))
UNAME := Cygwin
else
ifneq (,$(findstring WINDOWS,$(PATH)))
UNAME := Windows
else
UNAME := $(shell uname -s)
endif
endif
@lancejpollard
Copy link

What about something like this:

PATH_SEP = $(shell node -e "console.log(require('path').sep)")
# darwin (mac), linux, win32 (windows)
OS = $(shell node -e "console.log(require('os').platform())")

install-dependencies:
ifeq ("win32",$(OS))
bin$(PATH_SEP)dependencies
else
$(bin$(PATH_SEP)dependencies)
endif

@lancejpollard
Copy link

This is working for me:

PATH_SEP = $(shell node -e "console.log(require('path').sep)")
# darwin (mac), linux, win32 (windows)
OS = $(shell node -e "console.log(require('os').platform())")

install-dependencies:
ifeq (win32,$(OS))
    $(shell $(DEPENDENCIES))
else
    $(shell $(DEPENDENCIES))
endif
make install-dependencies

@lancejpollard
Copy link

Oops, add this to the top too (below OS):

DEPENDENCIES = bin$(PATH_SEP)dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment