blob: 5c7e8a5226d34b3d24222a4f4ea3383caf432210 (
plain) (
blame)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
CC = @CC@
CFLAGS ?= @CFLAGS@
CFLAGS += @CPPFLAGS@
SHARED = @SHARED@
LIBS = @LIBS@
INSTALL = @INSTALL@
SED = @SED@
STRIP = @STRIP@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
datarootdir = @datarootdir@
pkgconfigdir = @pkgconfigdir@
lmoddir = @lmoddir@
cmoddir = @cmoddir@
headers = @headers@
objects = @objects@
llibs = \
lem/repl.lua \
lem/parsers.lua \
lem/io.lua \
lem/io/queue.lua \
lem/lfs.lua \
lem/http.lua \
lem/http/server.lua \
lem/hathaway.lua
clibs = \
lem/utils.so \
lem/parsers/core.so \
lem/io/core.so \
lem/lfs/core.so \
lem/http/core.so
ifdef V
E=@\#
Q=
else
E=@echo
Q=@
endif
.PHONY: all strip install clean
all: CFLAGS += -DNDEBUG
all: bin/lem lem.pc $(clibs)
debug: bin/lem lem.pc $(clibs)
bin/libev.o: CFLAGS += -w
bin/lua.o: lua/luaconf.h
bin/lem.o: CFLAGS += -D'LEM_LDIR="$(lmoddir)/"'
%.o: %.c
$E ' CC $@'
$Q$(CC) $(CFLAGS) -c $< -o $@
bin/lem: $(objects)
$E ' LD $@'
$Q$(CC) $^ -o $@ -rdynamic $(LDFLAGS) $(LIBS)
%.so: %.c
$E ' CCLD $@'
$Q$(CC) $(CFLAGS) -fPIC -nostartfiles $(SHARED) $^ -o $@ $(LDFLAGS)
lua/luaconf.h: lua/luaconf.h.in
$E ' SED > $@'
$Q$(SED) \
-e 's|@lmoddir[@]|$(lmoddir)|' \
-e 's|@cmoddir[@]|$(cmoddir)|' \
$< > $@
lem.pc: lem.pc.in
$E ' SED > $@'
$Q$(SED) \
-e 's|@lmoddir[@]|$(lmoddir)|' \
-e 's|@cmoddir[@]|$(cmoddir)|' \
-e 's|@includedir[@]|$(includedir)|' \
-e 's|@Lua_CFLAGS[@]|@Lua_CFLAGS@|' \
$< > $@
%-strip: %
$E ' STRIP $<'
$Q$(STRIP) $(STRIP_ARGS) $<
strip: bin/lem-strip $(clibs:%=%-strip)
$(DESTDIR)$(bindir)/%: bin/%
$E ' INSTALL $@'
$Q$(INSTALL) -d $(dir $@)
$Q$(INSTALL) -m 755 $< $@
$(DESTDIR)$(includedir)/lem/%: lua/%
$E ' INSTALL $@'
$Q$(INSTALL) -d $(dir $@)
$Q$(INSTALL) -m 644 $< $@
$(DESTDIR)$(includedir)/lem/%: libev/%
$E ' INSTALL $@'
$Q$(INSTALL) -d $(dir $@)
$Q$(INSTALL) -m 644 $< $@
$(DESTDIR)$(includedir)/lem/%: include/%
$E ' INSTALL $@'
$Q$(INSTALL) -d $(dir $@)
$Q$(INSTALL) -m 644 $< $@
$(DESTDIR)$(lmoddir)/% $(DESTDIR)$(cmoddir)/% $(DESTDIR)$(pkgconfigdir)/%: %
$E ' INSTALL $@'
$Q$(INSTALL) -d $(dir $@)
$Q$(INSTALL) -m 644 $< $@
install: \
$(DESTDIR)$(bindir)/lem \
$(DESTDIR)$(pkgconfigdir)/lem.pc \
$(headers:%=$(DESTDIR)$(includedir)/lem/%) \
$(llibs:%=$(DESTDIR)$(lmoddir)/%) \
$(clibs:%=$(DESTDIR)$(cmoddir)/%)
clean:
rm -f bin/lem bin/*.o $(clibs) lua/luaconf.h lem.pc
|