-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (29 loc) · 827 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
CC := gcc
CFLAGS := -Wall -Werror -O2
# Library name and version
LIBRARY_NAME := redilon
LIBRARY_VERSION := 1.0
# Source files
SRCS := $(wildcard src/*.c)
OBJS := $(SRCS:.c=.o)
# Installation directories
PREFIX := /usr/local
LIBDIR := $(PREFIX)/lib
INCLUDEDIR := $(PREFIX)/include/
# Targets
TARGET := lib$(LIBRARY_NAME).so.$(LIBRARY_VERSION)
.PHONY: all install uninstall clean
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) -shared -o $@ $^
install: $(TARGET)
install -D -m 644 $(TARGET) $(LIBDIR)/$(TARGET)
install -D -m 644 $(TARGET) $(LIBDIR)/$(TARGET:.so.$(LIBRARY_VERSION)=.so)
install -d $(INCLUDEDIR)
install -m 644 ./src/redilon.h $(INCLUDEDIR)/$(LIBRARY_NAME).h
uninstall:
rm -f $(LIBDIR)/$(TARGET)
rm -f $(LIBDIR)/$(TARGET:.so.$(LIBRARY_VERSION)=.so)
rm -rf $(INCLUDEDIR)
clean:
rm -f $(TARGET) $(OBJS)