写一个简单的Makefile

时间:2025-03-28 19:07:01
all: osx
.PHONY: osx linux run osx: kale.dylib
linux : kale.so
run: kale.bin CC = gcc
OBJECTS = $(patsubst %.c,%.o,$(wildcard *.c)) $(OBJECTS): base64.h kale.dylib: $(OBJECTS)
$(CC) -dynamiclib -undefined suppress -flat_namespace -Wall $^ -o $@ kale.so: $(OBJECTS)
$(CC) -shared -Wall $^ -o $@ kale: $(OBJECTS)
$(CC) $^ -o $@ clean:
rm -rf *.o
rm -rf kale.dylib
rm -rf kale.so
rm -rf kale