c - 这个 makefile 是否消除了 .c 文件?

标签 c makefile

all: servidor
servidor: servidor.o
    gcc -lpthread -o servidor.o
servidor.o:
clean:
    gcc -c servidor.c
    rm -rf servidor.o

问题:

a) clean: 行是否删除了 servidor.c 文件?

b) 如何修改 makefile,以便它也编译 client.c 程序并创建 client.o

最佳答案

你的整个 makefile 应该是这样的:

LDLIBS=-lpthread
servidor: servidor.o client.o
clean:
<TAB>rm -f *.o

关于c - 这个 makefile 是否消除了 .c 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4367245/

相关文章:

c - 为什么我的 Makefile 每次都重新编译?

Makefile二次扩展

c - pthread_cleanup_push 和 pthread_mutex_unlock

c - g_io_scheduler_job_send_to_mainloop问题

c++ - 链接静态库而不是动态库

makefile - 如何有条件地包含子automake配置文件

makefile - 尝试在 Windows 子系统中为 Linux 错误编译内核模块

c - 位域困惑?

c++ - 解码无符号短值的函数

c - 没有错误的 C 程序的错误输出