#.SUFFIXES: .c .o
Cc =gcc
#OSA=/data/users/osa
IncDir=-I. -I./
Debug = -g
Cflags = -c $(DEBUG)
Libs = -lpthread
Lib_Dir=./
#/data/users/osa/api/
#PKIOBJ=PKITool.o kdmd5.o
Lib=alg.a
PkiObj=alg.o
.c.o:
$(Cc) $(Cflags) $(IncDir) $*.c
all: PKITool
#clean
PKITool:$(PkiObj)
ar ruv $(Lib_Dir)$(Lib) *.o
ranlib $(Lib_Dir)$(Lib)
clean:
rm *.o
target=testmake
cc = gcc
objects = main.o
#mult.o sub.o
link =
cflags = Wall -O
lflags = -lpthread
ar = ar
includes = -l
includelib =./alg.a
.PHONY:clean
all:$(target)
$(target):$(objects)
$(cc) $^ -o [email protected] $(lflag) $(includelib)
#$(objects) == $^
#edit:$(objects)
# $(cc) -o edit $(objects)
#$(TARGET): $(OBJS)
# $(CC) $^ -o [email protected] $(INCLUDE) $(LFLAGS)
main.o:main.c alg.h
$(cc) -c main.c
clean:
-rm *.o $(target)
这里的main调用库不能以系统文件形式包含
makefile编写---.a静态库的生成和调用,布布扣,bubuko.com