nginx源代码分析 - 生成的Makefile解析

生成的Makefile分析
变量赋值
CC,CFLAGS,CPP,LINK($CC),ALL_INCS(-I...),CORE_DEPS, CORE_INCS, HTTP_DEPS, HTTP_INCS

目标
build:  binary modules manpage
binary: objs/nginx
objs/nginx:     objs/src/core/nginx.o ... objs/src/http/ngx_http.o
    $(LINK) -o objs/nginx (...o)-ldl -lpthread -lcrypt -lpcre -lz -Wl,-E
下面是每个.o文件的编译规则
objs/ngx_modules.o:     $(CORE_DEPS) objs/ngx_modules.c
    (CC) -c $(CFLAGS) $(CORE_INCS) -o objs/ngx_modules.o objs/ngx_modules.c
...
objs/src/http/ngx_http.o:       $(CORE_DEPS) $(HTTP_DEPS) src/http/ngx_http.c
    $(CC) -c $(CFLAGS) $(CORE_INCS) $(HTTP_INCS) -o objs/src/http/ngx_http.o src/http/ngx_http.c
...
manpage:objs/nginx.8
objs/nginx.8:   docs/man/nginx.8 objs/ngx_auto_config.h
    sed -e ...替换现有文件内容

install:        build
创建目录,拷贝objs/nginx,/usr/local/nginx/sbin/nginx
conf/... /usr/local/nginx/conf/...
创建目录/usr/local/nginx/logs
...

你可能感兴趣的:(nginx源代码分析 - 生成的Makefile解析)