-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathMakefile.luarocks
More file actions
55 lines (43 loc) · 1.02 KB
/
Makefile.luarocks
File metadata and controls
55 lines (43 loc) · 1.02 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
ifndef VERBOSE
.SILENT:
endif
ifeq ($(OS), Windows_NT)
LIBEXT = .dll
LIBEXT_S = .dll.a
COPY = copy
RM = del
else ifeq ($(shell uname -s),Darwin)
LIBEXT = .dylib
LIBEXT_S = .a
COPY = cp -v
RM = rm -v -f
else
LIBEXT = .so
LIBEXT_S = .a
COPY = cp -v
RM = rm -v -f
endif
TARGET = python$(LIBEXT)
TARGET_S = python$(LIBEXT_S)
all: $(TARGET) $(TARGET_S)
##
CFLAGS := -Isrc -fPIC $(shell python3-config --embed --cflags) -DPYTHON_LIBRT=$(shell pkg-config python3-embed --keep-system-libs --libs | sed -e 's/-L//g' -e 's/ -l/\/lib/g' | xargs echo -n)$(LIBEXT) -I$(LUA_INCDIR)
LDFLAGS := $(shell python3-config --embed --ldflags)
ARFLAGS = $(shell python3-config --configdir)/libpython*$(LIBEXT_S)
OBJS := \
src/pythoninlua.o \
src/luainpython.o
$(TARGET): $(OBJS)
echo " LD $@"
$(LD) -shared -o $@ $^ $(LDFLAGS)
$(TARGET_S): $(OBJS)
echo " AR $@"
ar r $@ $^ $(ARFLAGS)
%.o: %.c
echo " CC $@"
$(CC) -c -o $@ $< $(CFLAGS)
install:
$(COPY) $(TARGET) $(LIBDIR)/
$(COPY) $(TARGET_S) $(LIBDIR)/
clean:
$(RM) $(TARGET) $(TARGET_S) $(OBJS)