乙個比較標準的makefile檔案

2021-05-27 18:30:04 字數 1117 閱讀 8126

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

makefile的乙個模板

include i.include i usr local include libxml2 i usr local ssl include i usr local include target agent lib lstdc lrt lpthread lxml2 objs patsubst cpp,...

編寫乙個makefile

什麼是makefile?對於大多數的windows程式設計師來講,makefile可能不是那麼重要,因為windows的ide都為程式設計師做好了這個工作。但是在linux下程式設計,會不會寫makefile,從側面上說明乙個人是否具備完成大型工程的能力。makefile的作用 makefile是用...

乙個Makefile例子

main.c include log.h intmain sum.c include log.h void sum sub.c include log.h void sub dev.c include log.h void sub mul.c include log.h void sub log.h...