- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在这本 Linux 手册中写道 make是:
a utility for building and maintaining groups of programs (and other types of files) from source code.
Description The purpose of the make utility is to determine automatically which pieces of a large program need to be re-compiled, and issue the commands necessary to recompile them.
这里的automatic determination
是什么意思?运行 make
或只运行 ./build.sh
我有我的构建脚本的主要/显着区别是什么?
最佳答案
What is the principal/significant difference between running
make
or just running./build.sh
where I have my build scripts?
make
可以很容易地使用,它只重建需要重建的部分(仅此而已)。
考虑一个要构建的项目,program
,由以下文件组成:
main.c
foo.c
bar.c
foo.h
bar.h
对于此讨论,我们假设 foo.c
和 bar.c
仅包括(即:依赖于)foo.h
和bar.c
,分别。
使用 build.sh
脚本,它只包含用于构建软件的命令,如下所示:
gcc -c foo.c
gcc -c bar.c
gcc -c main.c
gcc foo.o bar.o main.o -o program
如果只是foo.h
被修改,这个项目需要重建。使用这种方法,这将通过重新运行 build.sh
来完成,它会编译所有 源文件。请注意,bar.o
和 main.o
实际上都不需要再次生成,因为文件 bar.c
、 bar.h
、main.c
没有改变,它们根本不依赖于 foo.h
(即:它们不受在 foo.h
中更改)。
使用 make
但是,如果使用得当,会生成一个依赖图,这样只会再次生成需要更新的文件:在本例中为 foo. c
和程序
。
这依赖于源文件和目标文件(以及其他事物)之间的依赖关系被正确指定给 make
。这是通过 makefile 实现的:
program: main.o foo.o bar.o
gcc -o $@ $^
foo.c: foo.h
bar.c: bar.h
基本上,它明确指定:
程序
依赖于main.o
、foo.o
和bar.o
。foo.c
依赖于 foo.h
。bar.c
依赖于bar.c
。隐含地:
main.o
依赖main.c
foo.o
依赖于 foo.c
bar.o
依赖bar.c
这样一来,make
就知道每当发生变化时必须重建或更新的内容,并且它只会更新这些内容,而不是从头开始构建所有内容。
关于linux - make 命令和运行 build .sh 脚本之间的主要区别是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48719028/
我并不总是编写 make 文件,但当我这样做时,我喜欢尝试并写好它们。试图使界面与其他开发人员的期望一致始终是一项艰巨的任务。我正在寻找的是所有常见的 make some clean (GNU) ma
例如,我在运行 makefile 时收到这样的错误: make[3]: *** [/home/ziga/Downloads/openwrt/rakun_openwrt/staging_dir/ho
我必须创建一个 Makefile,它从不同文件夹中的 .c 文件创建单个可执行文件。 .c 文件包含来自任何这些文件夹的头文件。根目录有3个子目录x/y、x/z、a,所有这些子目录都有一些.c和.h文
您好,我有一个简单的 MakeFile,其中包含: clean: rm -f ex1 但是当我运行命令make clean 时,出现以下错误: make: *** No rule to mak
我已经为一些软件安装了它,但现在我根本不使用那个软件,所以我需要移除MinGW才能使用Cygwin进行Android开发。。我使用的是64位Windows 7
以下是针对我遇到的问题的简化生成文件: all: /tmp/makey/../filey @echo All done /tmp/filey: @echo Filey 当我运行 mak
获取错误: make: *** No rule to make target all. Stop." 在安装nagios主机期间运行此命令make all 最佳答案 可能的常见错误: 确保将文件命名为
当使用 -jN 运行 gnu-make 规则时,make 会创建 jobserver用于管理跨子制造商的工作数量。此外,您可以通过在 make 配方前添加 + 前缀来“将作业服务器环境传递”到 mak
使用 GNU Make 4.1 概括 我调用一个子品牌 b.mk来自生成文件 a.mk .b.mk被调用以确保构建子系统。 有时我想强制一个目标为 a.mk重制: make -f a.mk --al
这个问题与问题 2543127 的精神相似。 . 我有一个带有头文件列表的 gnu makefile。每个头文件可能位于不同的目录中,例如, HEADERS = $(wildcard *.h) $(w
假设我有以下 GNU make 目标: create_dir: @mkdir objects build_asm: $(ASM_FILES) @echo
我有一个具有以下结构的 Makefile(工作示例)。 .PHONY: image flashcard put-files put-files: @echo "=== put-files" i
我想要一个这样的makefile: cudaLib : # Create shared library with nvcc ocelotLib : # Create shared li
有没有比更好的方法来获取 GNU make 变量的第一个字符 FIRST=$(shell echo $(VARIABLE) | head -c 1) (不仅笨重而且还要调用外部shell)? 最佳答案
我通常使用像 cmake 这样的高级构建系统来构建我的 C/C++ 代码。但是由于各种原因,我直接使用 GNU make。 我正在进行递归构建,其中每个目录都有一个 makefile。 我最近不得不将
我通常使用像 cmake 这样的高级构建系统来构建我的 C/C++ 代码。但是由于各种原因,我直接使用 GNU make。 我正在进行递归构建,其中每个目录都有一个 makefile。 我最近不得不将
我安装了最新的mingw,发现没有mingw32-make了。有make.exe,所以我想知道最近是否将mingw32-make重命名为make.exe。 最佳答案 我不知道您从哪里获得 MinGW,
我正在使用 CentOS,但由于一个错误,许多软件包被删除了。所以我没有 yum 和 rpm。所以我想从源代码手动制作 yum,但我也没有制作。我知道一切都会用“制作包”制作。但是 make 自己呢?
考虑这个Makefile: .PHONY: all all: main.txt main.txt: build/main.txt cp build/main.txt . %/main.txt:
假设目录输入中有 1000 个扩展名为 .xhtml 的文件,并且这些文件的某个子集(输出路径在 $(FILES) 中)需要通过 xslt 转换为目录输出中具有相同名称的文件.一个简单的 make 规
我是一名优秀的程序员,十分优秀!