1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Pythonを使ってMakefileでOS判別

Posted at

WindowsとOSXで起動するファイルを変えたいという要望があったので、MakefileでOS判別してみました。
ちなみにWindowsではunameが動かないので今回はPythonplatformを使っています。

OSPLATFORM = $(shell python -c 'import platform; print platform.system()') 

参照
15.15. platform — 実行中プラットフォームの固有情報を参照する
http://docs.python.jp/2.7/library/platform.html

kickoff:
ifeq ($(OSPLATFORM),Windows)
    $(KICKOFF_BAT)
else ifeq ($(OSPLATFORM), Darwin)
    $(KICKOFF_SH)
endif

このように使います。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?