26 lines
411 B
Makefile
26 lines
411 B
Makefile
CC = gcc
|
|
CFLAGS = -Wall -Wextra -O2 -fPIC -D_GNU_SOURCE
|
|
LDFLAGS = -shared -lpthread -lrt
|
|
|
|
TARGET = libcrt.so
|
|
OBJS = shm.o ringbuf.o cache.o
|
|
|
|
.PHONY: all clean test
|
|
|
|
all: $(TARGET)
|
|
|
|
$(TARGET): $(OBJS)
|
|
$(CC) $(LDFLAGS) -o $@ $^
|
|
|
|
%.o: %.c %.h
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
test: test_crt
|
|
./test_crt
|
|
|
|
test_crt: test_crt.c $(TARGET)
|
|
$(CC) -o $@ $< -L. -lcrt -Wl,-rpath,.
|
|
|
|
clean:
|
|
rm -f $(OBJS) $(TARGET) test_crt
|