Last active
October 24, 2017 11:56
-
-
Save kosh04/01b49756ac3b2a21c833 to your computer and use it in GitHub Desktop.
Makefileで使用するコンパイラからターゲットとなるプラットフォームを判定する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC ?= cc | |
usage := make -f $(notdir $(MAKEFILE_LIST)) [CC=cc] | |
platform_list := linux bsd darwin mingw cygwin solaris | |
machine := $(shell $(CC) -dumpmachine) | |
# $(call grep, string, word-list) | |
grep = $(strip $(foreach word,$2,$(findstring $(word),$1))) | |
all: | |
@echo $(CC) -dumpmachine : $(machine) | |
@echo found : $(call grep, $(machine), $(platform_list)) | |
.PHONY: help usage | |
help usage: | |
@echo usage: $(usage) |
Bug 52096 - -dumpmachine does not respect -m32 - GCC Bugzilla
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52096
-dumpmachine
の表示するアーキテクチャ情報でビット判定はすべきでないと書かれている。
一応参考までに。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用例: