关于Linux操作系统makefile实例详细解析

;三个指令: (1)ifeq : 包含两个参数,被逗号分开,并被括在圆括号内 。ifeq与左括号之间要有空格 (2)else (3)endif : 结束条件语句 。例一: TARGET=helloworldCC=gccCFLAGS=-Wall -O -gSRC=https://www.rkxy.com.cn/dnjc/$(wildcard *.c)OBJS=$(patsubst %.c,%.o,$(wildcard *.c))$(TARGET):$(OBJS)$(CC) $(CFLAGS) $(OBJS) -o $@# $(RM) *.o%.o: %.c$(CC) $(CFLAGS) -c $< -o $@clean:rm -rf *.o helloworld例二: VPATH=OBJECTS=mmain.o ./pchild/pchild.oTARGET=mmCC=ccall:$(TARGET)$(TARGET):$(OBJECTS)$(CC) $(OBJECTS) -o $@rm -f $(OBJECTS)mmain.o:mmain.c$(CC) -c $< -o $@pchild.o:pchild.c pchild.h$(CC) -c $^ -o $@例三: VPATH=OBJECTS=mmain.o ./pchild/pchild.oYESNO=NOifeq ($(YESNO),YES)TARGET=mmelseTARGET=nnendifCC=ccall:$(TARGET)$(TARGET):$(OBJECTS)$(CC) $(OBJECTS) -o $@rm -f $(OBJECTS)

    推荐阅读