]>
Commit | Line | Data |
---|---|---|
a2177096 AM |
1 | From 9eae71dcd60834f753264ddde13f37993f8b5556 Mon Sep 17 00:00:00 2001 |
2 | From: Dan Callaghan <dcallagh@redhat.com> | |
3 | Date: Mon, 7 Jan 2013 09:37:31 +1000 | |
4 | Subject: [PATCH 1/2] build shared library | |
5 | ||
6 | --- | |
7 | Makefile | 29 +++++++++++++++++++++++++++-- | |
8 | 1 file changed, 27 insertions(+), 2 deletions(-) | |
9 | ||
10 | diff --git a/Makefile b/Makefile | |
11 | index 3086e92..a1a906f 100644 | |
12 | --- a/Makefile | |
13 | +++ b/Makefile | |
14 | @@ -1,4 +1,19 @@ | |
15 | -all: linenoise_example linenoise_utf8_example linenoise_cpp_example | |
16 | + | |
17 | +MAJOR_VERSION = 0 | |
18 | +EXTRA_VERSION = .0.0 | |
19 | +SONAME = liblinenoise.so.$(MAJOR_VERSION) | |
20 | +LIB = $(SONAME)$(EXTRA_VERSION) | |
21 | + | |
22 | +export CFLAGS ?= -Os -g | |
23 | +CFLAGS += -Wall -fpic -DUSE_UTF8 | |
24 | +LIBDIR ?= /usr/lib | |
25 | +INCLUDEDIR ?= /usr/include | |
26 | + | |
27 | +.PHONY: all | |
28 | +all: $(LIB) linenoise_example linenoise_utf8_example linenoise_cpp_example | |
29 | + | |
30 | +$(LIB): linenoise.o utf8.o | |
31 | + $(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) $(LDFLAGS) -o $@ $^ | |
32 | ||
33 | linenoise_example: linenoise.h linenoise.c example.c | |
34 | $(CC) -Wall -W -Os -g -o $@ linenoise.c example.c | |
35 | @@ -9,5 +24,15 @@ linenoise_utf8_example: linenoise.c utf8.c example.c | |
36 | linenoise_cpp_example: linenoise.h linenoise.c | |
37 | g++ -Wall -W -Os -g -o $@ linenoise.c example.c | |
38 | ||
39 | +.PHONY: clean | |
40 | clean: | |
41 | - rm -f linenoise_example linenoise_utf8_example linenoise_cpp_example *.o | |
42 | + rm -f $(LIB) linenoise_example linenoise_utf8_example linenoise_cpp_example *.o | |
43 | + | |
44 | +.PHONY: install | |
45 | +install: $(LIB) | |
46 | + install -m 0755 -d $(DESTDIR)$(INCLUDEDIR) | |
47 | + install -m 0644 linenoise.h $(DESTDIR)$(INCLUDEDIR) | |
48 | + install -m 0755 -d $(DESTDIR)$(LIBDIR) | |
49 | + install -m 0755 $(LIB) $(DESTDIR)$(LIBDIR) | |
4503e241 | 50 | + /sbin/ldconfig -n $(DESTDIR)$(LIBDIR) |
a2177096 AM |
51 | + ln -s $(LIB) $(DESTDIR)$(LIBDIR)/liblinenoise.so |
52 | -- | |
53 | 1.7.11.7 | |
54 |