Skip to content

Instantly share code, notes, and snippets.

@lancejpollard
Forked from thehydroimpulse/OS Check
Created September 28, 2012 01:32
Show Gist options
  • Select an option

  • Save lancejpollard/3797476 to your computer and use it in GitHub Desktop.

Select an option

Save lancejpollard/3797476 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
Author

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

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