-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (58 loc) · 1.69 KB
/
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
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
.POSIX:
PROJECT = libweb
PROJECT_A = $(PROJECT).a
MAJOR_VERSION = 0
MINOR_VERSION = 1
PATCH_VERSION = 0
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)
PROJECT_SO = $(PROJECT).so.$(VERSION)
PROJECT_SO_FQ = $(PROJECT).so.$(MAJOR_VERSION)
PROJECT_SO_NV = $(PROJECT).so
prefix = /usr/local
exec_prefix = $(prefix)
includedir = $(prefix)/include
datarootdir = $(prefix)/share
mandir = $(datarootdir)/man
libdir = $(exec_prefix)/lib
pkgcfgdir = $(libdir)/pkgconfig
O = -O1
CDEFS = -D_FILE_OFFSET_BITS=64 # Required for large file support on 32-bit.
CFLAGS = $(O) $(CDEFS) -g -Iinclude -Idynstr/include -fPIC -MD -MF $(@:.o=.d)
LDFLAGS = -shared
DEPS = $(OBJECTS:.o=.d)
OBJECTS = \
handler.o \
html.o \
http.o \
server.o \
wildcard_cmp.o
all: $(PROJECT_A) $(PROJECT_SO)
install: all $(pkgcfgdir)/libweb.pc
mkdir -p $(DESTDIR)$(includedir)
cp -R include/libweb $(DESTDIR)$(includedir)
chmod 0644 $(DESTDIR)$(includedir)/libweb/*.h
mkdir -p $(DESTDIR)$(libdir)
cp $(PROJECT_A) $(PROJECT_SO) $(DESTDIR)$(libdir)
chmod 0755 $(libdir)/$(PROJECT_A) $(DESTDIR)$(libdir)/$(PROJECT_SO)
ln -fs $(libdir)/$(PROJECT_SO) $(DESTDIR)$(libdir)/$(PROJECT_SO_FQ)
ln -fs $(libdir)/$(PROJECT_SO) $(DESTDIR)$(libdir)/$(PROJECT_SO_NV)
+cd doc && $(MAKE) install \
DESTDIR=$(DESTDIR) \
prefix=$(prefix) \
datarootdir=$(datarootdir) \
mandir=$(mandir)
clean:
rm -f $(OBJECTS) $(DEPS)
+cd examples && $(MAKE) clean
FORCE:
examples: FORCE
+cd examples && $(MAKE)
$(PROJECT_A): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(PROJECT_SO): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
$(pkgcfgdir)/libweb.pc: libweb.pc
mkdir -p $(pkgcfgdir)
sed -e 's,/usr/local,$(prefix),' $< > $@
chmod 0644 $@
-include $(DEPS)