forked from rain-1/linenoise-mob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (27 loc) · 782 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
PREFIX = /usr/local
CC = cc
CFLAGS = -Os -Wall -Wextra
SRC = linenoise.c utf8.c
OBJ = $(SRC:.c=.o)
LIB = liblinenoise.a
INC = linenoise.h utf8.h
MAN = linenoise.3
all: $(LIB) example
$(LIB): $(OBJ)
$(AR) -rcs $@ $(OBJ)
example: example.o $(LIB)
$(CC) -o $@ example.o $(LIB)
.c.o:
$(CC) $(CFLAGS) -c $<
install: $(LIB) $(INC) $(MAN)
mkdir -p $(DESTDIR)$(PREFIX)/lib
cp $(LIB) $(DESTDIR)$(PREFIX)/lib/$(LIB)
mkdir -p $(DESTDIR)$(PREFIX)/include
cp $(INC) $(DESTDIR)$(PREFIX)/include/$(INC)
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3
cp $(MAN) $(DESTDIR)$(PREFIX)/share/man/man3/$(MAN)
lib: linenoise.h linenoise.c
$(CC) -Wall -W -Os -o linenoise.o linenoise.c encodings/utf8.c
ar rcs liblinenoise.a linenoise.o utf8.o
clean:
rm -f $(LIB) example example.o $(OBJ)