-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
50 lines (39 loc) · 1.11 KB
/
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
49
50
TARGET = libcedrus.so.1
SRC = cedrus.c cedrus_mem_ve.c cedrus_mem_ion.c
INC = cedrus.h cedrus_regs.h
CFLAGS ?= -Wall -Wextra -O3
LDFLAGS ?=
LIBS = -lpthread
CC ?= gcc
prefix ?= /usr/local
libdir ?= $(prefix)/lib
includedir ?= $(prefix)/include
ifeq ($(USE_UMP),1)
SRC += cedrus_mem_ump.c
CFLAGS += -DUSE_UMP
LIBS += -lUMP
endif
DEP_CFLAGS = -MD -MP -MQ $@
LIB_CFLAGS = -fpic -fvisibility=hidden
LIB_LDFLAGS = -shared -Wl,-soname,$(TARGET)
OBJ = $(addsuffix .o,$(basename $(SRC)))
DEP = $(addsuffix .d,$(basename $(SRC)))
.PHONY: clean all install uninstall
all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $(LIB_LDFLAGS) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
clean:
rm -f $(OBJ)
rm -f $(DEP)
rm -f $(TARGET)
install: $(TARGET) $(INC)
install -D $(TARGET) $(DESTDIR)/$(libdir)/$(TARGET)
ln -sf $(TARGET) $(DESTDIR)/$(libdir)/$(basename $(TARGET))
install -D -t $(DESTDIR)/$(includedir)/cedrus/ $(INC)
uninstall:
rm -f $(DESTDIR)/$(libdir)/$(basename $(TARGET))
rm -f $(DESTDIR)/$(libdir)/$(TARGET)
rm -rf $(DESTDIR)/$(includedir)/cedrus
%.o: %.c
$(CC) $(DEP_CFLAGS) $(LIB_CFLAGS) $(CFLAGS) -c $< -o $@
include $(wildcard $(DEP))