makefile - What is the nmake equivalent of filter-out?
问题描述
I've been given a makefile for ubuntu, and I'm trying to use it with nmake on Windows 10.
nmake doesn't seem to recognize the filter-out
keyword such as in the following line:
OBJS_TEST = $(filter-out $(EXE_OBJ), $(OBJS))
Does nmake have a keyword with the same functionality?
For completeness, the lines from the beginning of the file before the above line (and a few lines below) are as follows:
EXE = main
TEST = test
OBJS_DIR = .objs
###############################################
### THE LINE IN QUESTION IS BELOW #############
OBJS_TEST = $(filter-out $(EXE_OBJ), $(OBJS))
###############################################
CPP_TEST = $(wildcard tests/*.cpp)
# CPP_TEST += uiuc/catch/catchmain.cpp
# The above line doesn't work with the "+=" extension in nmake; replace with below.
CPP_TEST = $(CPP_TEST) $(wildcard tests/*.cpp)
The error reported is:
fatal error U1001: syntax error : illegal character '-' in macro
解决方案
As far as I'm aware there is no equivalent to filter-out
in nmake. Also, nmake does not support the wildcard
function so you'll have to deal with that. And, I'm suspicious that your replacement for +=
won't work; in most versions of POSIX make FOO = $(FOO)
is illegal as it gives an infinite loop of variable lookup. Maybe nmake works differently, though.
nmake is SO different from POSIX make and GNU make that you will either have to rewrite the makefile from scratch, or else just go get a version of GNU make for Windows (or build it yourself). GNU make is quite portable and runs well on Windows. That would be a LOT less work.
推荐阅读
- angular - 新生成的 jhipster 应用程序未在 prod 模式下显示前端(404 错误)
- blockchain - 如何在 ERC20 中使用 enableSweep() 函数?
- wordpress - 在 Woocommerce 中信用卡被拒绝时防止创建帐户?
- hyperledger-fabric - composer-rest-server 身份验证重要问题
- html - 是否可以明确地使网格项始终出现在最后一行或最后一列?
- html - 移动浏览器上的 html 确认电子邮件损坏
- python - 单括号和双括号中的 Python Trim 帮助变量
- python - 对数对数尺度 sns.jointplot
- java - JVM 崩溃后无法打开 hprof 文件是否会在 JVM 崩溃时正确创建 hprof 文件?
- python - 从 Matplotlib Raster 到 Geoviews/Holoviews/hvplot:如何转换 x、y 和 z