forked from clibs/list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (33 loc) · 742 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
AR ?= ar
CC ?= gcc
PREFIX ?= /usr/local
CFLAGS = -O3 -std=c99 -Wall -Wextra -Ideps
SRCS = src/list.c \
src/list_node.c \
src/list_iterator.c
OBJS = $(SRCS:.c=.o)
all: build/liblist.a
install: all
cp -f build/liblist.a $(PREFIX)/lib/liblist.a
cp -f src/list.h $(PREFIX)/include/list.h
uninstall:
rm -f $(PREFIX)/lib/liblist.a
rm -f $(PREFIX)/include/list.h
build/liblist.a: $(OBJS)
@mkdir -p build
$(AR) rcs $@ $^
bin/test: test.o $(OBJS)
@mkdir -p bin
$(CC) $^ -o $@
bin/benchmark: benchmark.o $(OBJS)
@mkdir -p bin
$(CC) $^ -o $@
%.o: %.c
$(CC) $< $(CFLAGS) -c -o $@
clean:
rm -fr bin build *.o src/*.o
test: bin/test
@./$<
benchmark: bin/benchmark
@./$<
.PHONY: test benchmark clean install uninstall