本文主要是介绍boa源码分析(1)--Makefile,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
makefile yacc include gcc cgi flex
- # Generated automatically from Makefile.in by configure.
- # $Id: Makefile.in,v 1.59 2002/03/24 22:20:19 jnelson Exp $
- //本makefile 由autotools生成
- .SUFFIXES:
- .SUFFIXES: .o .c //去掉原后缀,添加新后缀
- .PHONY: clean mrclean distclean depend all dist //伪目标
- GCC_FLAGS = -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual\
- -Wtraditional\
- -Wshadow\
- -Wconversion\
- -Waggregate-return\
- -Wmissing-prototypes\
- -Wnested-externs\
- -Wall \
- -Wundef -Wwrite-strings -Wredundant-decls -Winline
- srcdir = .
- VPATH = .:./../extras //如果依赖文件或目标文件在当前目录下没找到的话,就到这两个目录来找(这两个目录由冒号分隔)
- #LDFLAGS = -g
- LIBS =
- CFLAGS += -pipe -Wall -I.
- # Change these if necessary
- YACC = bison -y //yacc是个语法分析器 生成的文件后缀为.Y
- LEX = flex //词法分析器,生成的文件后缀为.L
- #CC = arm-linux-gcc
- #CPP = arm-linux-gcc -E
- SOURCES = alias.c boa.c buffer.c cgi.c cgi_header.c config.c escape.c \
- get.c hash.c ip.c log.c mmap_cache.c pipe.c queue.c read.c \
- request.c response.c select.c signals.c util.c sublog.c
- OBJS = y.tab.o lex.yy.o $(SOURCES:.c=.o) timestamp.o //$(SOURCES:.c=.o)用了替换,将SOURCES中的.c替换成了.o
- //all是伪目标,默认目标
- all: boa boa_indexer
- rm -rf $(OBJS)
- chmod +x boa
- @echo "build boa finish."
- boa: $(OBJS)
- $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) //$@ $^ $? $< $*都是自动化变量
- boa_indexer: index_dir.o escape.o
- $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
- clean:
- rm -f $(OBJS) boa core lex.yy.c y.tab.c y.tab.h *~ boa_indexer index_dir.o *.d
- distclean: mrclean
- mrclean: clean
- rm -f config.status config.cache config.h Makefile config.log
- # parser dependencies
- y.tab.c y.tab.h: boa_grammar.y
- $(YACC) -d $^
- lex.yy.c: boa_lexer.l
- $(LEX) $^
- # timestamp
- timestamp.o: $(SOURCES) boa_grammar.y boa_lexer.l
- // 用gcc -MM可以生成源文件的依赖关系,.depend文件原来都有了,可以make depend重新制作
- # depend stuff
- .depend:
- $(CPP) -MM $(SOURCES) > .depend // ">"重定向
- depend:
- -rm -f .depend
- $(MAKE) .depend
- include .depend
- # tags
- tags: $(SOURCES) //更新所有的目标,以备完整地重编译使用。
- ctags -o tags $^ *.h
- # dist
- dist:
- $(MAKE) clean
- ./makedist.sh
- # object dump
- boa.objdump: boa
- objdump --disassemble-all --source boa > $@
这篇关于boa源码分析(1)--Makefile的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!