标签: makefile

什么是Makefile.am和Makefile.in?

这两个文件主要出现在开源项目中.

它们是什么,它们是如何工作的?

automake makefile autotools

312
推荐指数
4
解决办法
17万
查看次数

如何制作SIMPLE C++ Makefile?

我们需要使用Makefile将所有内容整合到我们的项目中,但我们的教授从未向我们展示过如何操作.

我只有一个档案a3driver.cpp.驱动程序从某个位置导入类"/user/cse232/Examples/example32.sequence.cpp".

就是这样,其他一切都包含在内.cpp.

我如何制作一个简单的Makefile来创建一个名为a3a.exe?的可执行文件?

c++ makefile

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

如何强制make/gcc向我显示命令?

我正在尝试调试编译问题,但我似乎无法获得GCC(或者可能是make ??)来向我展示它正在执行的实际编译器和链接器命令.这是我看到的输出:

  CCLD   libvirt_parthelper
libvirt_parthelper-parthelper.o: In function `main':
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:102: undefined reference to `ped_device_get'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:116: undefined reference to `ped_disk_new'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:122: undefined reference to `ped_disk_next_partition'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:172: undefined reference to `ped_disk_next_partition'
/root/qemu-build/libvirt-0.9.0/src/storage/parthelper.c:172: undefined reference to `ped_disk_next_partition'
collect2: ld returned 1 exit status
make[3]: *** [libvirt_parthelper] Error 1
Run Code Online (Sandbox Code Playgroud)

我想看到的应该与此类似:

$ make
gcc -Wall   -c -o main.o main.c
gcc -Wall   -c -o hello_fn.o hello_fn.c
gcc   main.o hello_fn.o   -o main
Run Code Online (Sandbox Code Playgroud)

请注意此示例如何显示完整的gcc命令.以上示例仅显示"CCLD libvirt_parthelper"之类的内容.我不确定如何控制这种行为.

gcc makefile verbosity

250
推荐指数
7
解决办法
25万
查看次数

操作系统检测makefile

我经常在几台不同的计算机和几种不同的操作系统上工作,这些操作系统是Mac OS X,Linux或Solaris.对于我正在进行的项目,我从远程git存储库中提取代码.

无论我在哪个终端,我都希望能够处理我的项目.到目前为止,我已经找到了通过每次切换计算机时更改makefile来绕过操作系统更改的方法.然而,这是乏味的,并引起一堆头痛.

如何修改我的makefile,以便它检测我正在使用哪个操作系统并相应地修改语法?

这是makefile:

cc = gcc -g
CC = g++ -g
yacc=$(YACC)
lex=$(FLEX)

all: assembler

assembler: y.tab.o lex.yy.o
        $(CC) -o assembler y.tab.o lex.yy.o -ll -l y

assembler.o: assembler.c
        $(cc) -o assembler.o assembler.c

y.tab.o: assem.y
        $(yacc) -d assem.y
        $(CC) -c y.tab.c

lex.yy.o: assem.l
        $(lex) assem.l
        $(cc) -c lex.yy.c

clean:
        rm -f lex.yy.c y.tab.c y.tab.h assembler *.o *.tmp *.debug *.acts
Run Code Online (Sandbox Code Playgroud)

makefile os-agnostic os-detection

237
推荐指数
10
解决办法
15万
查看次数

使用Makefile和CMake编译代码之间的区别

我在C/C++上编码并使用(GNU)Makefile来编译代码.我可以用CMake做同样的事情并获得MakeFile.但是,使用Makefile和CMake编译代码有什么区别?

c c++ makefile cmake

237
推荐指数
2
解决办法
9万
查看次数

我在哪里可以找到适用于Mac OS X Lion的"make"程序?

刚刚将我的计算机升级到Mac OS X Lion并转到终端并键入"make",但它说:-bash:make:command not found

"make"命令在哪里?

macos makefile osx-lion

222
推荐指数
4
解决办法
19万
查看次数

如何在makefile中打印出变量

在我的makefile中,我有一个变量'NDK_PROJECT_PATH',我的问题是如何在编译时将其打印出来?

我读了Make文件echo显示"$ PATH"字符串,我试过:

@echo $(NDK_PROJECT_PATH)
@echo $(value NDK_PROJECT_PATH)
Run Code Online (Sandbox Code Playgroud)

两个都给了我

"build-local.mk:102: *** missing separator.  Stop."
Run Code Online (Sandbox Code Playgroud)

任何人都知道为什么它不适合我?

makefile gnu-make

222
推荐指数
8
解决办法
30万
查看次数

出错:缺少分隔符

运行时出现以下错误make:

Makefile:168: *** missing separator.  Stop.
Run Code Online (Sandbox Code Playgroud)

是什么造成的?

makefile

208
推荐指数
7
解决办法
15万
查看次数

什么是makeinfo,我该如何获得它?

我正在尝试构建GNU grep,当我运行make时,我得到:

[snip]
/bin/bash: line 9: makeinfo: command not found
Run Code Online (Sandbox Code Playgroud)

什么是makeinfo,我该如何获得它?

(这是Ubuntu,如果它有所作为)

ubuntu grep gcc makefile

206
推荐指数
6
解决办法
20万
查看次数

如何在Makefile中编写循环?

我想执行以下命令:

./a.out 1
./a.out 2
./a.out 3
./a.out 4
.
.
. and so on
Run Code Online (Sandbox Code Playgroud)

如何把这个东西写成一个循环Makefile

loops makefile

201
推荐指数
7
解决办法
22万
查看次数