forked from buserror/libc3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (79 loc) · 2.3 KB
/
Makefile
File metadata and controls
104 lines (79 loc) · 2.3 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
VERSION = 0.1.1
REVISION = 1
SHELL := ${shell which bash}
IPATH += src
IPATH += srcgl
VPATH += src
VPATH += srcgl
OBJ := obj-${shell $(CC) -dumpmachine}
C3SRC = ${wildcard src/*.c}
C3OBJ = ${patsubst src/%,${OBJ}/%,${C3SRC:.c=.lo}}
C3GLSRC = ${wildcard srcgl/*.c}
C3GLOBJ = ${patsubst srcgl/%,${OBJ}/%,${C3GLSRC:.c=.lo}}
CC = clang
PKGCONFIG = pkg-config
INSTALL = install
PLATFORM = ${shell uname | tr '[A-Z]' '[a-z]'}
ifeq (${PLATFORM}, darwin)
# you need to install libtool via 'brew install libtool' on the mac
LIBTOOL = glibtool
else
LIBTOOL = libtool
endif
CONFIG_H = c3config-${PLATFORM}.h
CPPCAIRO := ${shell $(PKGCONFIG) --cflags pango cairo 2>/dev/null}
CFLAGS = -g -O2
CPPFLAGS := --std=gnu99 -fPIC
CPPFLAGS += ${patsubst %,-I%,${subst :, ,${IPATH}}}
CPPFLAGS += $(CPPCAIRO)
LDFLAGS +=
DESTDIR = /usr/local
-include ${wildcard .make.options*}
all: ${OBJ} src/$(CONFIG_H) ${OBJ}/libc3.la ${OBJ}/libc3gl.la
${OBJ}:
mkdir -p ${OBJ}
ifneq (${V}, 1)
E=@
LIBTOOL += --quiet
endif
src/$(CONFIG_H): Makefile
$(E)rm -f $@
$(E)echo CONFIG $@
$(E)( \
printf "#ifndef __C3_CONFIG__\n#define __C3_CONFIG__\n"; \
printf "#define CONFIG_C3_VERSION \"$(VERSION)\"\n"; \
printf "#define CONFIG_C3_PLATFORM \"$(PLATFORM)\"\n"; \
$(PKGCONFIG) --exists pango cairo || printf "// " ; \
printf "#define CONFIG_C3_CAIRO 1\n"; \
printf "#endif\n"; \
) >$@
${OBJ}/libc3.la: ${C3OBJ}
@echo LINK $@
$(E)$(LIBTOOL) --mode=link --tag=CC \
$(CC) $(CPPFLAGS) $(CFLAGS) \
$^ -o $@ \
-version-info 0:1:0 \
-rpath $(DESTDIR)/lib $(LDFLAGS)
${OBJ}/libc3gl.la: ${C3GLOBJ}
@echo LINK $@
$(E)$(LIBTOOL) --mode=link --tag=CC \
$(CC) $(CPPFLAGS) $(CFLAGS) \
$^ -o $@ \
-version-info 0:1:0 \
-rpath $(DESTDIR)/lib $(LDFLAGS)
${OBJ}/%.lo: %.c
@echo CC $<
$(E)$(LIBTOOL) --mode=compile --tag=CC \
$(CC) $(CPPFLAGS) $(CFLAGS) -MT $@ -MMD \
$< -c -o $@
install:
mkdir -p $(DESTDIR)/lib/pkgconfig $(DESTDIR)/include/c3
rm -f $(DESTDIR)/lib/libc3* $(DESTDIR)/include/c3/*
$(INSTALL) src/*.h $(DESTDIR)/include/c3/
cp -a ${OBJ}/.libs/*.a ${OBJ}/.libs/*.so* $(DESTDIR)/lib/
sed -e 's|PREFIX|${DESTDIR}|g' -e 's|VERSION|${VERSION}|g' \
libc3.pc >$(DESTDIR)/lib/pkgconfig/libc3.pc
clean:
rm -rf ${OBJ}
# include the dependency files generated by gcc, if any
-include ${wildcard ${OBJ}/*.d}