CC = g++
CFLAGS += -Wall -fPIC
CFLAGS += $(OPTFLAGS)
SRCS += $(wildcard ./src/*.cpp)
HEADERS += $(wildcard ./inc/*.h)
OBJECTS := $(patsubst %.cpp, %.o, $(SRCS))
TARGET := ps_http_measure.so
INCS := -I./inc
LIBS =
LIBPATH += -L./lib
BINPATH := ./bin/
vpath %.cpp src
vpath %.h inc
%.o:%.cpp
@$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
%.o:%.c
@$(CC) $(CFLAGS) $(INCS) -o $@ -c $<
all:$(TARGET) $(SUPPORT)
$(TARGET):$(OBJECTS)
@$(CC) -o $(BINPATH)$(TARGET) $^ $(LIBPATH) $(LIBS) -shared
@rm -f *.o $(OBJECTS)
@echo 'make successfully!'
debug: CFLAGS += -DDEBUG -g
debug: all
@echo 'debug mode'
.PHONY: clean prepare debug
clean:
@rm -f $(OBJECTS) *.o ./bin/*
prepare:
@$(CC) -MM $(INCS) $(SRCS) >> makefile
#$(OBJECTS):$(HEADERS)
destroy.o: src/destroy.cpp inc/http_measure.h inc/destroy.h \
inc/http_measure.h
global_field_names.o: src/global_field_names.cpp
http_measure.o: src/http_measure.cpp inc/http_measure.h inc/initial.h \
inc/destroy.h inc/http_measure.h inc/ps_rule.h inc/others.h
initial.o: src/initial.cpp inc/http_measure.h inc/initial.h
others.o: src/others.cpp inc/http_measure.h inc/others.h
文件目錄:
bin
inc
lib(.a .so)
makefile(文件)
src