一个比较标准的makefile文件

来源:互联网 发布:淘宝主图视频尺寸 编辑:程序博客网 时间:2024/06/05 07:52
INC_PATH = -I./
LIB_PATH = -L./lib
LIB = -lxlog -lpthread -liconv  -lMD5


CC = g++
CPPFLAGS = -Wall $(INC_PATH) -g


OBJS = src/spider.o src/s_hash.o src/html_store.o src/utils.o  src/global.o src/s_crawler.o src/s_url_praser.o src/html_head_praser.o src/wipscs_socket_client.o src/wiprdss_socket.o \
       adns/types.o adns/event.o adns/query.o adns/reply.o adns/general.o adns/setup.o adns/transmit.o adns/parse.o \
       adns/poll.o adns/check.o src/url_format.o src/s_dns_resolve.o src/CharsetConverter.o src/url_format.o src/priority_list.o src/priority_list_index.o
TARGET = newspider
all: $(TARGET)


newspider:$(OBJS)
$(CC) -o $@ $^ $(LIB_PATH) $(LIB)
rm -f src/*.o *.o


clean:

rm -f src/*.o *.o


在加上一个:

CC=gcc


objects = thread_pool.o tp_test.o queue.o


.PHONY: all
all: tp_test


tp_test: $(objects)
$(CC) -o tp_test -lpthread $(CFLAGS) $(objects)


$(objects): thread_pool.h queue.h


.PHONY: clean
clean:
-rm tp_test *.o 
exec:
./tp_tes

原创粉丝点击