问题描述
我想创建一个用于编译Minix系统中使用多个C文件一个Makefile。我将如何改变Makefile文件,使其编译多个文件在同一时间?下面是我的Makefile的当前状态。
I am trying to create a Makefile that compiles multiple C files for use in Minix. How would I change the Makefile so that it compiles multiple files at the same time? Below is the current state of my Makefile.
CFLAGS = -D_POSIX_SOURCE
LDFLAGS =
CC = CC
LD = CC
CFLAGS = -D_POSIX_SOURCELDFLAGS =CC = ccLD = cc
PROG =测试
OBJS = test.o
OBJS = test.o
$(PROG):$(OBJS)
$(LD)$(LDFLAGS)$(OBJS)-o $(PROG)
$(PROG): $(OBJS) $(LD) $(LDFLAGS) $(OBJS) -o $(PROG)
清理:
室射频$(PROG)$(OBJS)
clean: rm -rf $(PROG) $(OBJS)
我以为我可以只列出PROG后,其他程序和OBJS如
I thought I could just list the other programs after PROG and OBJS such as
PROG =测试测试2
PROG = test test2
OBJS = test.o test2.o
OBJS = test.o test2.o
但没有奏效。有任何想法吗?先谢谢了。
but that didn't work. Any ideas? Thanks in advance.
推荐答案
拆分它是这样的:
PROG1 = test
PROG2 = test2
OBJ1 = test.o
OBJ2 = test2.o
$(PROG1): $(OBJ1)
$(LD) $(LDFLAGS) $(OBJ1) -o $(PROG1)
$(PROG2): $(OBJ2)
$(LD) $(LDFLAGS) $(OBJ2) -o $(PROG2)
等
这篇关于创建生成文件编译多个C文件中使用的Minix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!