1.简化主机架构名称(HOSTARCH)和主机操作系统名称(HOSTOS)------L31~L40
- HOSTARCH := $(shell uname -m | \
- sed -e s/i.86/i386/ \
- -e s/sun4u/sparc64/ \
- -e s/arm.*/arm/ \
- -e s/sa110/arm/ \
- -e s/powerpc/ppc/ \
- -e s/macppc/ppc/)
- HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
- sed -e 's/\(cygwin\).*/cygwin/')
在此使用了 shell 命令 sed ,此命令会把主机架构名“i686”替换为“i386”,把主机操作系统“Linux”替换为“linux”,目的是尽量统一主机的架构名和操作系统类型。- ifdef O
- ifeq ("$(origin O)", "command line")
- BUILD_DIR := $(O)
- endif
- endif
- ifneq ($(BUILD_DIR),)
- saved-output := $(BUILD_DIR)
- # Attempt to create a output directory.
- $(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
- # Verify if it was successful.
- BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
- $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
- endif # ifneq ($(BUILD_DIR),)
有两种方式指定输出文件的目录:
(1)Add O= to the make command line
# 'make O=/tmp/build all'
(2) Set environement variable BUILD_DIR to point to the desired location
# 'export BUILD_DIR=/tmp/build'
# 'make'
阅读(239) | 评论(0) | 转发(0) |