MakeFile基本使用

简介: MakeFile Makingmakefile demo# Run this line when useing `make` command# default is the target which is an output id in this makefile# name after `...

MakeFile Making

makefile demo

# Run this line when useing `make` command
# default is the target which is an output id in this makefile
# name after `:` are the dependent targets, when run this line `make` command will check if this target already exists in the makefile
# if not exists, `make` will run the dependent target line to create the target
# the second line is command area, in this area, you can run any valid command yout like, but because of it's target, we put the clang or
# gcc in the area
default: makefile
     clang main.c tools.c

# tools.o is an output target which is an global in this makefile
tools.o: default makefile
     clang tools.c -c

# app is an output target which is an global in this makefile
app: default tools.o
     clang main.o tools.o
# I'm sure if you use Linux or Unix now and then, and install some applications by source code, you must be familiar with this `clean`
# We often some clean action is the area, such as `rm -rf someconffile` and so on.
# There are three brothers named `clean`, `mrproper` and 'disclean' in a single makefile
clean:
    rm -rf main.o tools.o

disclean: clean
    rm -rf a.out
目录
相关文章
|
3月前
|
Shell Linux C++
Makefile编译实战
Makefile编译实战
55 0
|
3月前
|
存储 编译器 C++
|
6月前
|
Java 编译器 Linux
Makefile教程(入门介绍)
Makefile教程(入门介绍)
77 0
|
2天前
Makefile(1)入门
Makefile(1)入门
13 0
|
2天前
|
编译器 Shell Linux
Makefile(3)进阶
Makefile(3)进阶
14 0
|
1月前
|
编译器 测试技术
如何编写自己的Makefile(1)
如何编写自己的Makefile(1)
9 1
|
5月前
|
Shell
如何使用makefile
如何使用makefile
|
5月前
|
IDE 编译器 程序员
编写Makefile
编写Makefile
37 0
|
6月前
|
存储 Shell vr&ar
Makefile基础教程(函数的使用)
Makefile基础教程(函数的使用)
54 0

热门文章

最新文章