相关疑难解决方法(0)

Makefile,用于区分Windows和类Unix系统

我想在Linux和Windows上构建相同的Makefile.我在Linux上使用默认的GNU make,在Windows上使用 mingw32-make(也是GNU make).

我希望Makefile检测它是在Windows还是Linux上运行.


例如make clean,Windows上的命令如下所示:

clean:
    del $(DESTDIR_TARGET)
Run Code Online (Sandbox Code Playgroud)

但在Linux上:

clean:
    rm $(DESTDIR_TARGET)
Run Code Online (Sandbox Code Playgroud)

另外我想在Windows(\)和Linux(/)上使用不同的目录分隔符.


可以在Makefile中检测Windows操作系统吗?

PS:我不想在Windows上模拟Linux(cygwin等)

有类似的问题:操作系统检测makefile,但我没有在这里找到答案.

linux windows makefile os-detection

42
推荐指数
3
解决办法
3万
查看次数

如何在windows node.js上运行Mocha测试(错误:找不到模块'C:\ cygdrive\c\Users)

我正试图在Windows中运行一个应用程序,这个应用程序有一些摩卡测试.我需要制作.我看了这个

摩卡需要制作.找不到适用于Windows的make.exe

还有这个

Node.js无法找到模块 - 在Windows上干扰cygwin

我在Github目录中有应用程序(在cygwin目录结构之外),我安装了windows版本的节点.

我尝试使用PowerShell并按照建议设置别名,但我总是得到

> module.js:340
>     throw err;
>           ^ Error: Cannot find module 'C:\cygdrive\c\Users\Nicola\AppData\Roaming\npm\node_modules\mocha\bin\mocha'
>     at Function.Module._resolveFilename (module.js:338:15)
>     at Function.Module._load (module.js:280:25)
>     at Module.runMain (module.js:487:10)
>     at process.startup.processNextTick.process._tickCallback (node.js:244:9) Makefile:5: recipe for target `test' failed make: ***
> [test] Error 1
Run Code Online (Sandbox Code Playgroud)

并且我在该目录中安装了mocha(BTW为什么他不在node_modules subdir中查找mocha?).问题似乎是我该C:\cygdrive\c\Users如何解决这个问题?

我也尝试将文件复制到cygwin下的home /目录但是我得到了

./node_modules/.bin/mocha: line 1: ../mocha/bin/mocha: No such file or directory
Makefile:5: recipe for target `test' failed
make: *** [test] Error 127
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

cygwin makefile mocha.js node.js

11
推荐指数
2
解决办法
1万
查看次数

当试图让Mocha观看我的项目时,"没有这样的模块"错误

我正在尝试让Mocha观看我的项目进行测试并不断运行测试但是当我使用-w标志时我得到一个错误.

这里测试执行正常:

C:\Foo>mocha

  .

  ? 1 tests complete (3ms)
Run Code Online (Sandbox Code Playgroud)

在这里 -w

C:\Foo>mocha -w


node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: No such module
    at EventEmitter.<anonymous> (node.js:392:27)
    at Object.<anonymous> (C:\Users\Greg\AppData\Roaming\npm\node_modules\mocha\bin\_mocha:203:11)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)
Run Code Online (Sandbox Code Playgroud)

我在全局安装了Mocha(npm install -g mocha)并且应该在本地安装到项目中.

我在64位Windows 7家庭高级版上使用节点v0.6015,Mocha 1.0.1和0.6.1.

mocha.js windows-7 node.js

7
推荐指数
2
解决办法
1410
查看次数

标签 统计

makefile ×2

mocha.js ×2

node.js ×2

cygwin ×1

linux ×1

os-detection ×1

windows ×1

windows-7 ×1