Skip to content

Commit 4f23afe

Browse files
author
Kevin Pyle
committed
Build: move name 'python.so' to Make variable
Allow the user to change the name of the generated shared object by specifying an alternate $GCC_PYTHON_PLUGIN_SO on the command line.
1 parent 598c566 commit 4f23afe

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ PYTHON_CONFIG=python-config
9797
PYTHON_INCLUDES=$(shell $(PYTHON_CONFIG) --includes)
9898
PYTHON_LIBS=$(shell $(PYTHON_CONFIG) --libs)
9999

100+
GCC_PYTHON_PLUGIN_SO := python.so
101+
100102
CPPFLAGS+= -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -I. $(PYTHON_INCLUDES)
101103
# Allow user to pick optimization, choose whether warnings are fatal,
102104
# and choose debugging information level.
@@ -110,9 +112,9 @@ endif
110112

111113
all: autogenerated-config.h testcpybuilder test-suite testcpychecker
112114

113-
plugin: autogenerated-config.h python.so
115+
plugin: autogenerated-config.h $(GCC_PYTHON_PLUGIN_SO)
114116

115-
python.so: $(PLUGIN_OBJECT_FILES)
117+
$(GCC_PYTHON_PLUGIN_SO): $(PLUGIN_OBJECT_FILES)
116118
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared $^ -o $@ $(LIBS)
117119

118120
$(PLUGIN_OBJECT_GENERATED_FILES): CPPFLAGS+= $(if $(srcdir),-I$(srcdir))
@@ -145,7 +147,7 @@ autogenerated-variable.c: autogenerated-gimple-types.txt $(srcdir)maketreetypes.
145147
# Doing so seems to require that paths be absolute, rather than relative
146148
# to this directory
147149
TEST_CFLAGS= \
148-
-fplugin=$(CURDIR)/python.so \
150+
-fplugin=$(CURDIR)/$(GCC_PYTHON_PLUGIN_SO) \
149151
-fplugin-arg-python-script=test.py
150152

151153
# A catch-all test for quick experimentation with the API:

0 commit comments

Comments
 (0)