blob: 04dd6fa1f42f0d6e7cb90dab21a42e793d0af47b (
plain)
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
|
--- ldbus-9f6db626600eb7e04000368da947e0c5cd175fb5.orig/src/Makefile
+++ ldbus-9f6db626600eb7e04000368da947e0c5cd175fb5/src/Makefile
@@ -1,22 +1,33 @@
-LUA_LIBDIR = /usr/local/lib/lua/5.3
+LUA_VERSION ?= 5.3
+LUA_LIBDIR = /usr/local/lib/lua/$(LUA_VERSION)
-CFLAGS += -Wall -Wextra --pedantic -Wno-long-long
-CFLAGS += `pkg-config --cflags lua5.3 dbus-1`
-CFLAGS += -fPIC
-CFLAGS += -I ../vendor/compat-5.3/c-api
+O = obj$(LUA_VERSION)
+MY_CFLAGS += $(CFLAGS)
+MY_CFLAGS += -Wall -Wextra --pedantic -Wno-long-long
+MY_CFLAGS += `pkg-config --cflags lua$(LUA_VERSION) dbus-1`
+MY_CFLAGS += -g -fPIC
+MY_CFLAGS += -I ../vendor/compat-5.3/c-api
LIBS = `pkg-config --libs dbus-1`
-OBJS = ldbus.o error.o pending_call.o connection.o bus.o message.o message_iter.o timeout.o watch.o ../vendor/compat-5.3/c-api/compat-5.3.o
+OBJS = $(addprefix $(O)/, ldbus.o error.o pending_call.o connection.o bus.o message.o message_iter.o timeout.o watch.o compat-5.3.o)
-all: ldbus.so
+all: $(O)/ldbus.so
-ldbus.so: $(OBJS)
- $(CC) -o ldbus.so -shared $(CFLAGS) $^ $(LIBS)
+$(O)/compat-5.3.o: ../vendor/compat-5.3/c-api/compat-5.3.c
+ @mkdir -p $(O)
+ $(CC) -c -o $@ $(MY_CFLAGS) $<
+$(O)/%.o: %.c
+ @mkdir -p $(O)
+ $(CC) -c -o $@ $(MY_CFLAGS) $<
+
+$(O)/ldbus.so: $(OBJS)
+ $(CC) -o $@ -shared $(MY_CFLAGS) $^ $(LIBS)
+
clean:
rm -f -- ldbus.so $(OBJS)
-install: ldbus.so
+install: $(O)/ldbus.so
mkdir -p $(LUA_LIBDIR)
- cp ldbus.so $(LUA_LIBDIR)
+ cp $(O)/ldbus.so $(LUA_LIBDIR)
|