Files
ortools-clone/makefiles/Makefile.python.mk

140 lines
6.9 KiB
Makefile
Raw Normal View History

2011-04-06 13:37:23 +00:00
# Python support using SWIG
# Main target
python: pycp pyalgorithms pygraph pylp
# Clean target
clean_python:
-$(DEL) gen$Salgorithms$S*python_wrap*
-$(DEL) gen$Sconstraint_solver$S*python_wrap*
-$(DEL) gen$Sgraph$S*python_wrap*
-$(DEL) gen$Slinear_solver$S*python_wrap*
-$(DEL) gen$Salgorithms$S*.py
-$(DEL) gen$Sconstraint_solver$S*.py
-$(DEL) gen$Sgraph$S*.py
-$(DEL) gen$Slinear_solver$S*.py
-$(DEL) _pywrap*.$(SHAREDLIBEXT)
-$(DEL) objs$S*python_wrap.$O
2011-04-06 13:37:23 +00:00
# pywrapknapsack_solver
pyalgorithms: _pywrapknapsack_solver.$(SHAREDLIBEXT) gen/algorithms/pywrapknapsack_solver.py
2011-04-06 13:37:23 +00:00
gen/algorithms/pywrapknapsack_solver.py: algorithms/knapsack_solver.swig algorithms/knapsack_solver.h base/base.swig
2012-01-06 22:24:16 +00:00
$(SWIG_BINARY) -c++ -python -o gen/algorithms/knapsack_solver_python_wrap.cc -module pywrapknapsack_solver algorithms/knapsack_solver.swig
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
gen/algorithms/knapsack_solver_python_wrap.cc: gen/algorithms/pywrapknapsack_solver.py
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
objs/knapsack_solver_python_wrap.$O: gen/algorithms/knapsack_solver_python_wrap.cc
$(CCC) $(CFLAGS) $(PYTHON_INC) -c gen/algorithms/knapsack_solver_python_wrap.cc $(OBJOUT)objs/knapsack_solver_python_wrap.$O
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
_pywrapknapsack_solver.$(SHAREDLIBEXT): objs/knapsack_solver_python_wrap.$O $(ALGORITHMS_LIBS) $(LP_LIBS) $(BASE_LIBS)
$(LD) $(LDOUT)_pywrapknapsack_solver.$(SHAREDLIBEXT) objs/knapsack_solver_python_wrap.$O $(ALGORITHMS_LNK) $(LDFLAGS) $(PYTHON_LNK)
2011-04-06 16:26:35 +00:00
ifeq "$(SYSTEM)" "win"
2011-04-07 12:45:28 +00:00
copy _pywrapknapsack_solver.dll gen\\algorithms\\_pywrapknapsack_solver.pyd
2011-04-06 16:26:35 +00:00
endif
2011-04-06 13:37:23 +00:00
# pywrapgraph
pygraph: _pywrapgraph.$(SHAREDLIBEXT) gen/graph/pywrapgraph.py
2011-04-06 13:37:23 +00:00
gen/graph/pywrapgraph.py: graph/graph.swig graph/min_cost_flow.h graph/max_flow.h graph/ebert_graph.h base/base.swig
$(SWIG_BINARY) -c++ -python -o gen/graph/pywrapgraph_python_wrap.cc -module pywrapgraph graph/graph.swig
2011-04-06 13:37:23 +00:00
gen/graph/pywrapgraph_python_wrap.cc: gen/graph/pywrapgraph.py
2011-04-06 13:37:23 +00:00
objs/pywrapgraph_python_wrap.$O: gen/graph/pywrapgraph_python_wrap.cc
$(CCC) $(CFLAGS) $(PYTHON_INC) -c gen/graph/pywrapgraph_python_wrap.cc $(OBJOUT)objs/pywrapgraph_python_wrap.$O
2011-04-06 13:37:23 +00:00
_pywrapgraph.$(SHAREDLIBEXT): objs/pywrapgraph_python_wrap.$O $(GRAPH_DEPS)
$(LD) $(LDOUT)_pywrapgraph.$(SHAREDLIBEXT) objs/pywrapgraph_python_wrap.$O $(GRAPH_LNK) $(LDFLAGS) $(PYTHON_LNK)
2011-04-06 16:26:35 +00:00
ifeq "$(SYSTEM)" "win"
copy _pywrapgraph.dll gen\\graph\\_pywrapgraph.pyd
2011-04-06 16:26:35 +00:00
endif
2011-04-06 13:37:23 +00:00
# pywrapcp
pycp: _pywrapcp.$(SHAREDLIBEXT) gen/constraint_solver/pywrapcp.py _pywraprouting.$(SHAREDLIBEXT) gen/constraint_solver/pywraprouting.py
2011-04-06 13:37:23 +00:00
gen/constraint_solver/pywrapcp.py: constraint_solver/constraint_solver.swig constraint_solver/constraint_solver.h constraint_solver/constraint_solveri.h base/base.swig
2012-01-06 22:24:16 +00:00
$(SWIG_BINARY) -c++ -python -o gen/constraint_solver/constraint_solver_python_wrap.cc -module pywrapcp constraint_solver/constraint_solver.swig
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
gen/constraint_solver/constraint_solver_python_wrap.cc: gen/constraint_solver/pywrapcp.py
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
objs/constraint_solver_python_wrap.$O: gen/constraint_solver/constraint_solver_python_wrap.cc
$(CCC) $(CFLAGS) $(PYTHON_INC) -c gen/constraint_solver/constraint_solver_python_wrap.cc $(OBJOUT)objs/constraint_solver_python_wrap.$O
2011-04-06 13:37:23 +00:00
_pywrapcp.$(SHAREDLIBEXT): objs/constraint_solver_python_wrap.$O $(CP_DEPS)
$(LD) $(LDOUT)_pywrapcp.$(SHAREDLIBEXT) objs/constraint_solver_python_wrap.$O $(CP_LNK) $(LDFLAGS) $(PYTHON_LNK)
2011-04-06 16:26:35 +00:00
ifeq "$(SYSTEM)" "win"
copy _pywrapcp.dll gen\\constraint_solver\\_pywrapcp.pyd
endif
2011-04-06 13:37:23 +00:00
# pywraprouting
gen/constraint_solver/pywraprouting.py: constraint_solver/routing.swig constraint_solver/constraint_solver.h constraint_solver/constraint_solveri.h constraint_solver/routing.h base/base.swig
2012-01-06 22:24:16 +00:00
$(SWIG_BINARY) -c++ -python -o gen/constraint_solver/routing_python_wrap.cc -module pywraprouting constraint_solver/routing.swig
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
gen/constraint_solver/routing_python_wrap.cc: gen/constraint_solver/pywraprouting.py
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
objs/routing_python_wrap.$O: gen/constraint_solver/routing_python_wrap.cc
$(CCC) $(CFLAGS) $(PYTHON_INC) -c gen/constraint_solver/routing_python_wrap.cc $(OBJOUT)objs/routing_python_wrap.$O
2011-04-06 13:37:23 +00:00
_pywraprouting.$(SHAREDLIBEXT): objs/routing_python_wrap.$O $(ROUTING_DEPS)
$(LD) $(LDOUT)_pywraprouting.$(SHAREDLIBEXT) objs/routing_python_wrap.$O $(ROUTING_LNK) $(LDFLAGS) $(PYTHON_LNK)
2011-04-06 16:26:35 +00:00
ifeq "$(SYSTEM)" "win"
copy _pywraprouting.dll gen\\constraint_solver\\_pywraprouting.pyd
endif
2011-04-06 13:37:23 +00:00
# pywraplp
pylp: _pywraplp.$(SHAREDLIBEXT) gen/linear_solver/pywraplp.py
2011-04-06 13:37:23 +00:00
2011-12-05 19:40:55 +00:00
gen/linear_solver/pywraplp.py: linear_solver/linear_solver.swig linear_solver/linear_solver.h base/base.swig gen/linear_solver/linear_solver.pb.h
2012-01-06 22:24:16 +00:00
$(SWIG_BINARY) $(SWIG_INC) -c++ -python -o gen/linear_solver/linear_solver_python_wrap.cc -module pywraplp linear_solver/linear_solver.swig
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
gen/linear_solver/linear_solver_python_wrap.cc: gen/linear_solver/pywraplp.py
2011-04-06 13:37:23 +00:00
2012-01-06 22:24:16 +00:00
objs/linear_solver_python_wrap.$O: gen/linear_solver/linear_solver_python_wrap.cc
$(CCC) $(CFLAGS) $(PYTHON_INC) -c gen/linear_solver/linear_solver_python_wrap.cc $(OBJOUT)objs/linear_solver_python_wrap.$O
2011-04-06 13:37:23 +00:00
_pywraplp.$(SHAREDLIBEXT): objs/linear_solver_python_wrap.$O $(LP_DEPS)
$(LD) $(LDOUT)_pywraplp.$(SHAREDLIBEXT) objs/linear_solver_python_wrap.$O $(LP_LNK) $(LDFLAGS) $(PYTHON_LNK)
2011-04-06 16:26:35 +00:00
ifeq "$(SYSTEM)" "win"
copy _pywraplp.dll gen\\linear_solver\\_pywraplp.pyd
endif
# Build stand-alone archive file for redistribution.
python_archive: python
-$(DELREC) temp
$(MKDIR) temp
$(MKDIR) temp$Sor-tools.$(PLATFORM)
$(MKDIR) temp$Sor-tools.$(PLATFORM)$Spython
$(MKDIR) temp$Sor-tools.$(PLATFORM)$Sconstraint_solver
$(MKDIR) temp$Sor-tools.$(PLATFORM)$Slinear_solver
$(MKDIR) temp$Sor-tools.$(PLATFORM)$Sgraph
$(MKDIR) temp$Sor-tools.$(PLATFORM)$Salgorithms
$(COPY) python$S*.py temp$Sor-tools.$(PLATFORM)$Spython
$(COPY) gen$Sconstraint_solver$S*.py temp$Sor-tools.$(PLATFORM)$Sconstraint_solver
$(COPY) gen$Slinear_solver$S*.py temp$Sor-tools.$(PLATFORM)$Slinear_solver
$(COPY) gen$Sgraph$S*.py temp$Sor-tools.$(PLATFORM)$Sgraph
$(COPY) gen$Salgorithms$S*.py temp$Sor-tools.$(PLATFORM)$Salgorithms
$(TOUCH) temp$Sor-tools.$(PLATFORM)$Sconstraint_solver$S__init__.py
$(TOUCH) temp$Sor-tools.$(PLATFORM)$Slinear_solver$S__init__.py
$(TOUCH) temp$Sor-tools.$(PLATFORM)$Sgraph$S__init__.py
$(TOUCH) temp$Sor-tools.$(PLATFORM)$Salgorithms$S__init__.py
ifeq ("$(SYSTEM)","win")
2012-01-08 19:16:33 +00:00
cd temp$Sor-tools.$(PLATFORM) && ..\..\tools\tar.exe -C ..$S.. -c -v --exclude *svn* data | ..\..\tools\tar.exe xvm
$(COPY) gen$Sconstraint_solver$S_pywrapcp.pyd temp$Sor-tools.$(PLATFORM)$Sconstraint_solver
$(COPY) gen$Slinear_solver$S_pywraplp.pyd temp$Sor-tools.$(PLATFORM)$Slinear_solver
$(COPY) gen$Sgraph$S_pywrapgraph.pyd temp$Sor-tools.$(PLATFORM)$Sgraph
$(COPY) gen$Salgorithms$S_pywrapknapsack_solver.pyd temp$Sor-tools.$(PLATFORM)$Salgorithms
cd temp && ..$Stools$Szip.exe -r ..$SGoogle.OrTools.python.$(PLATFORM).$(SVNVERSION).zip or-tools.$(PLATFORM)
else
2012-01-08 19:16:33 +00:00
cd temp$Sor-tools.$(PLATFORM) && tar -C ..$S.. -c -v --exclude \*svn\* data | tar xvm -
$(COPY) _pywrap*.$(SHAREDLIBEXT) temp$Sor-tools.$(PLATFORM)
2012-01-08 19:16:33 +00:00
cd temp && tar cvzf ..$SGoogle.OrTools.python.$(PLATFORM).$(SVNVERSION).tar.gz or-tools.$(PLATFORM)
endif
-$(DELREC) temp