-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (41 loc) · 1.19 KB
/
Makefile
File metadata and controls
56 lines (41 loc) · 1.19 KB
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
49
50
51
52
53
54
55
56
CC ?= gcc
AR ?= ar
RANLIB ?= ranlib
CFLAGS ?= -O3 -std=c11 -Wall -Wextra -Wshadow -Wconversion -Wpedantic -fPIC
INCS := -Iinclude -Iinternal
# Public API wrapper sources
SRC_API := \
src/psort_u.c \
src/psort_u128.c \
src/psort_u256.c \
src/psort_u512.c
# Internal algorithm sources (copied into internal/)
SRC_INTERNAL := \
internal/pipe_sort_u128.c \
internal/pipe_sort_u256_idx_radix8.c \
internal/pipe_sort_u512_idx_radix8.c
OBJ := $(SRC_API:.c=.o) $(SRC_INTERNAL:.c=.o)
LIB_STATIC := libpipesort.a
LIB_SHARED := libpipesort.so
PREFIX ?= /usr/local
.PHONY: all static shared clean install uninstall
all: static
static: $(LIB_STATIC)
shared: $(LIB_SHARED)
$(LIB_STATIC): $(OBJ)
$(AR) rcs $@ $^
$(RANLIB) $@
$(LIB_SHARED): $(OBJ)
$(CC) -shared -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) $(INCS) -c $< -o $@
clean:
rm -f $(OBJ) $(LIB_STATIC) $(LIB_SHARED)
install: static
install -d $(DESTDIR)$(PREFIX)/include/pipesort
install -m 644 include/pipesort/*.h $(DESTDIR)$(PREFIX)/include/pipesort/
install -d $(DESTDIR)$(PREFIX)/lib
install -m 644 $(LIB_STATIC) $(DESTDIR)$(PREFIX)/lib/
uninstall:
rm -rf $(DESTDIR)$(PREFIX)/include/pipesort
rm -f $(DESTDIR)$(PREFIX)/lib/$(LIB_STATIC)