一 生成动态链接库的模板:
1 ####################### 2 # Makefile 3 ####################### 4 5 # compile and lib parameter 6 CC := g++ 7 LIBS := 8 LDFLAGS := 9 DEFINES := 10 INCLUDE := -I. 11 CFLAGS := 12 CXXFLAGS:= 13 14 # link parameter 15 #LIB := libfunc.so 16 LIB := libfunc.a 17 18 #link 19 $(LIB):func.o 20 $(CC) -shared -o -fPIC -o $@ $^ 21 #compile 22 func.o:thread.c 23 $(CC) -c -fPIC $^ -o $@ 24 25 # clean 26 clean: 27 rm -fr *.o