Makefile:静态库与动态库
CC = gcc
COMPILER_FLAGS = -O2
objects = mathApi.o main.o
bin = hello.exe
static = libmath.a
shared = libmath.so
all:main
main:$(objects)
$(CC) -o $(bin) $(objects)
static:mathApi.o
ar cr $(static) mathApi.o
shared:mathApi.o
$(CC) $(COMPILER_FLAG) mathApi.o -shared -fPIC -o $(shared)
.PHONY: clean
clean:
rm -f $(objects) $(bin)