1.自动化变量通配符
2.wildcard 使用
3.srcs=(wildcard:%。o=%。c)说明
4.$(srcs):%.o:%.c说明==$(patsubst %.c,%.o $(wildcard *.c))==$($(wildcard *.c):%.c=%.o)
5.规则
6.bug报错
me:
Target = auto
Cc = gcc
Cflags = -Wall -OLflags = -lpthreadInclude = -I Ar = arLibs =Srcs = $(wildcard *.c)
#$(wildcard,./sub/*.c) qudiao ','Incs = $(wildcard *.h)Objects = $(Srcs:%.c=%.o).PHONY:clean release install
all: release
print: @echo $(Srcs) @echo $(Incs) @echo $(Objects) @echo "why???"release:$(Target)$(Target):$(Objects)
$(Cc) $^ -o $@ @echo $@ @echo "pkf"$(Objects):%.o:%.c $(Incs) // this is not need!!!!! $(Cc) -c $< -o $@ @echo $@ @echo $<clean: -rm *.o -rm $(Target)
exmple:
==============================================================
Target = TestIniGCC = gccG++ = g++CInc = $(wildcard *.h)
CSrc = $(wildcard *.c)Cobjects =$(CSrc:%.c=%.o)
#Cobjects =$(patsubst %.c,%.o,$(CSrc)) release:$(Target)$(Target): $(Cobjects)
$(GCC) -o $@ $^
##################test######################
#CInc += iniparser.h dictionary.h
#CSrc += iniparser.c dictionary.c#Cobjects += iniparser.o dictionary.o#CppObejects =#$(Cobjects):$(Csrc)# $(GCC) $(CInc) -c $<#$(Target): iniparser.o dictionary.o
# $(GCC) -o $@ $^ #iniparser.o: iniparser.c# $(GCC) $(CInc) -c $<#dictionary.o: dictionary.c# $(GCC) $(CInc) -c $< clean: rm -rf *.o $(Target) *.gch===================================================
wildcard netdir patsubst
make -f makefile release