-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
30 lines (22 loc) · 1005 Bytes
/
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
.PHONY: clean all run test
CFLAGS=`pkg-config --cflags python3 guile-2.2`
PYTHON_EMBED_PRESENT=$(shell pkg-config --exists python3-embed;echo $$?)
ifeq ($(PYTHON_EMBED_PRESENT), 0)
LDFLAGS=`pkg-config --libs python3-embed guile-2.2`
else
LDFLAGS=`pkg-config --libs python3 guile-2.2`
endif
STATIC_SOURCES=python-guile.c python-guile-utils.c pyobject-data.c python-locking.c
GENERATED_SOURCES=auto-wrappers.c auto-define-gsubr.c auto-exported.txt
ALL_SOURCES=$(STATIC_SOURCES) $(GENERATED_SOURCES)
run: all
GUILE_LOAD_PATH=$GUILE_LOAD_PATH:. LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. guile python-demo.scm
test: all
GUILE_LOAD_PATH=$GUILE_LOAD_PATH:. LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. guile test-libpython.scm
all: python-guile.so
python-guile.so: $(STATIC_SOURCES) $(GENERATED_SOURCES)
gcc -fPIC -shared $(CFLAGS) -o $@ $(STATIC_SOURCES) $(LDFLAGS) -lpthread
$(GENERATED_SOURCES): template.scm meta-create-c-binding.scm
guile meta-create-c-binding.scm $<
clean:
rm -f *.o *.so $(GENERATED_SOURCES)