【发布时间】:2010-09-24 06:56:21
【问题描述】:
我正在尝试通过使用一个通用的 makefile 来整合一些构建信息。我的问题是我想使用来自不同子目录级别的 makefile,这使得工作目录值 (pwd) 无法预测。例如:
# Makefile.common
TOP := $(shell pwd)
COMPONENT_DIR := $(TOP)/component
COMPONENT_INC := $(COMPONENT_DIR)/include
COMPONENT_LIB := $(COMPONENT_DIR)/libcomponent.a
如果我从子目录中包含Makefile.common,就像这样,$(TOP) 目录不正确,其他所有内容都遵循:
# other_component/Makefile
include ../Makefile.common
# $(COMPONENT_LIB) is incorrectly other_component/component
让Makefile.common 使用自己的 目录路径而不是更善变的pwd 的最佳方法是什么?
【问题讨论】:
标签: makefile