一:
case = case1
all:${case}
#test wildcard ,patsubst
#source := $(wildcard *.c) $(wildcard *.cc)
source := $(wildcard *.c)
#objs := $(patsubst %.c,%.o,$(patsubst %.cc %.o,$(source)))
objs := $(patsubst %.c,%.o,$(source))
kobjs := $(filter k%.o,$(objs))
mobjs := $(filter m%.o,$(objs))
case1:$(objs)
cc -o mdis $(mobjs)
cc -o kdis $(kobjs)
rm *.o
$(objs):%.o:%.c
$(CC) -c $(CFLAGS) $< -o $@
二:
case = case1
all:${case}
#test wildcard ,patsubst
#source := $(wildcard *.c) $(wildcard *.cc)
source := $(wildcard *.c)
#objs := $(patsubst %.c,%.o,$(patsubst %.cc %.o,$(source)))
objs := $(patsubst %.c,%.o,$(source))
case1:$(objs)
cc -o dis $(objs)
rm *.o
$(objs):%.o:%.c
$(CC) -c $(CFLAGS) $< -o $@