forked from json-parser/json-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
68 lines (52 loc) · 1.89 KB
/
Makefile.in
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
57
58
59
60
61
62
63
64
65
66
67
exec_prefix = @exec_prefix@
prefix = @prefix@
includedir = $(DESTDIR)@includedir@
libdir = $(DESTDIR)@libdir@
datadir = $(DESTDIR)@datadir@
AR = @AR@
CC = @CC@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
SRCS = $(wildcard *.c)
OBJS = $(SRCS:.c=.o)
ifeq ($(shell uname),Darwin)
SO_EXT := dylib
else
SO_EXT := so
CFLAGS := -fPIC $(CFLAGS)
endif
SO_NAME := libjsonparser.$(SO_EXT).@VERSION_MAJOR@
REAL_NAME = libjsonparser.$(SO_EXT).@PACKAGE_VERSION@
all: libjsonparser.a libjsonparser.$(SO_EXT)
libjsonparser.a: $(OBJS)
$(AR) rcs libjsonparser.a json.o
libjsonparser.so: $(OBJS)
$(CC) -shared -Wl,-soname,$(SO_NAME) -o libjsonparser.so $^
libjsonparser.dylib: $(OBJS)
$(CC) -dynamiclib json.o -o libjsonparser.dylib
%.o: %.c
$(CC) $(CFLAGS) -c $^
clean:
rm -f libjsonparser.$(SO_EXT) libjsonparser.a json.o
install-shared: libjsonparser.$(SO_EXT)
@echo Installing pkgconfig module: $(datadir)/pkgconfig/json-parser.pc
@install -d $(datadir)/pkgconfig/ || true
@install -m 0644 json-parser.pc $(datadir)/pkgconfig/json-parser.pc
@echo Installing shared library: $(libdir)/libjsonparser.$(SO_EXT)
@install -d $(libdir) || true
@install -m 0755 libjsonparser.$(SO_EXT) $(libdir)/$(REAL_NAME)
@rm -f $(libdir)/$(SO_NAME)
@ln -s $(REAL_NAME) $(libdir)/$(SO_NAME)
@rm -f $(libdir)/libjsonparser.$(SO_EXT)
@ln -s $(SO_NAME) $(libdir)/libjsonparser.$(SO_EXT)
@install -d $(includedir)/json-parser || true
@install -m 0644 ./json.h $(includedir)/json-parser/json.h
install-static: libjsonparser.a
@echo Installing static library: $(libdir)/libjsonparser.a
@install -m 0755 libjsonparser.a $(libdir)/libjsonparser.a
@install -d $(includedir)/json-parser || true
@install -m 0644 ./json.h $(includedir)/json-parser/json.h
install: install-shared install-static
@echo Compiler flags: -I$(includedir)/json-parser
@echo Linker flags: -L$(libdir) -ljsonparser
.PHONY: all clean install install-shared install-static