CC=gcc
CFLAGS=-g
LDFLAGS=
#INCLUDE=
#LIBS=
OUTDIR=.bin
EXAMPLES += udpserver udpclient tcpserver tcpserver2 tcpclient select epoll
OBJS=$(addsuffix .o,$(EXAMPLES))
#all:
# mkdir -p $(OUTDIR)
# for i in $(EXAMPLES) ; do \
# $(CC) $(CFLAGS) -o $(OUTDIR)/$$i "$$i.c"; \
# done
all:$(OBJS) $(EXAMPLES)
%: %.o
$(CC) $(OUTDIR)/$< $(LDFLAGS) -o $(OUTDIR)/$@
%.o: %.c
if [ ! -d $(OUTDIR) ]; then mkdir -p $(OUTDIR); fi
$(CC) $< $(CFLAGS) -c -o $(OUTDIR)/$@
clean:
rm -rf *.o $(OUTDIR) $(EXAMPLES)
网络编程专栏中用到的Makefile
最新推荐文章于 2022-09-15 16:07:48 发布