xref: /aoo41x/main/pyuno/source/module/makefile.mk (revision bca6f9a9)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27PRJ=..$/..
28
29PRJNAME=pyuno
30TARGET=pyuno
31ENABLE_EXCEPTIONS=TRUE
32
33LINKFLAGSDEFS = # do not fail with missing symbols
34
35# --- Settings -----------------------------------------------------
36
37.INCLUDE :  settings.mk
38.IF "$(L10N_framework)"==""
39#-------------------------------------------------------------------
40
41.IF "$(OS)$(COMEX)" == "SOLARIS4"
42# no -Bdirect for SunWS CC
43DIRECT = $(LINKFLAGSDEFS)
44.ENDIF
45
46# special setting from environment
47.IF "$(EXTRA_CFLAGS)"!=""
48EXTRA_FRAMEWORK_FLAG=-framework Python
49.ENDIF # .IF "$(EXTRA_CFLAGS)"!=""
50
51.IF "$(GUI)" == "UNX"
52# python expects modules without the lib prefix
53# pyuno.so even on Mac OS X, because it is a python module
54PYUNO_MODULE=$(DLLDEST)$/pyuno.so
55PYUNORC=pyunorc
56.ELIF "$(GUI)" == "OS2"
57#.INCLUDE :  pyversion.mk
58PYUNORC=pyuno.ini
59.ELSE
60.INCLUDE :  pyversion.mk
61PYUNORC=pyuno.ini
62DLLPOST=.pyd
63.ENDIF
64
65.IF "$(SYSTEM_PYTHON)" == "YES"
66PYTHONLIB=$(PYTHON_LIBS)
67CFLAGS+=$(PYTHON_CFLAGS)
68.ELSE # "$(SYSTEM_PYTHON)" == "YES"
69.INCLUDE :  pyversion.mk
70CFLAGS+=-I$(SOLARINCDIR)$/python
71.ENDIF # "$(SYSTEM_PYTHON)" == "YES"
72
73SHL1TARGET=$(TARGET)
74SLOFILES= \
75		$(SLO)$/pyuno_runtime.obj 	\
76		$(SLO)$/pyuno.obj 		\
77		$(SLO)$/pyuno_callable.obj 	\
78		$(SLO)$/pyuno_module.obj 	\
79		$(SLO)$/pyuno_type.obj 		\
80		$(SLO)$/pyuno_util.obj		\
81		$(SLO)$/pyuno_except.obj	\
82		$(SLO)$/pyuno_adapter.obj	\
83		$(SLO)$/pyuno_gc.obj
84
85# remove this, when issue i35064 is integrated
86.IF "$(COM)"=="GCC"
87NOOPTFILES= \
88	$(SLO)$/pyuno_module.obj
89.ENDIF			# "$(COM)"=="GCC"
90
91
92SHL1STDLIBS= \
93		$(CPPULIB)		\
94		$(CPPUHELPERLIB)	\
95		$(SALLIB)		\
96		$(PYTHONLIB) 		\
97		$(EXTRA_FRAMEWORK_FLAG)
98
99SHL1DEPN=
100SHL1LIBS=$(SLB)$/$(TARGET).lib
101SHL1IMPLIB=i$(TARGET)
102
103SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
104
105DEF1NAME=	$(SHL1TARGET)
106DEF1DEPN=	$(MISC)$/pyuno.flt
107
108DEFLIB1NAME=$(TARGET)
109
110# --- Targets ------------------------------------------------------
111
112.IF "$(GUI)$(COM)"=="WNTGCC"
113ALLTAR : \
114	$(DLLDEST)$/uno.py 		\
115	$(DLLDEST)$/unohelper.py	\
116	$(PYUNO_MODULE)			\
117	$(MISC)$/$(PYUNORC)		\
118	$(LB)$/lib$(TARGET).a
119
120$(LB)$/lib$(TARGET).a: $(MISC)$/$(TARGET).def
121	dlltool --dllname $(TARGET)$(DLLPOST) --input-def=$(MISC)$/$(TARGET).def --kill-at --output-lib=$(LB)$/lib$(TARGET).a
122.ELSE
123ALLTAR : \
124	$(DLLDEST)$/uno.py 		\
125	$(DLLDEST)$/unohelper.py	\
126	$(PYUNO_MODULE)			\
127	$(MISC)$/$(PYUNORC)
128.ENDIF
129.ENDIF
130
131.INCLUDE :  target.mk
132.IF "$(L10N_framework)"==""
133$(DLLDEST)$/%.py: %.py
134	cp $? $@
135
136
137.IF "$(GUI)" == "UNX"
138$(PYUNO_MODULE) : $(SLO)$/pyuno_dlopenwrapper.obj
139.IF "$(OS)" == "LINUX"
140	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSRUNPATH_OOO) $(LINKFLAGSSHLCUI) -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
141.ELIF "$(OS)" == "SOLARIS"
142	@echo ld -G -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
143.ELIF "$(OS)" == "FREEBSD"
144	@echo ld -shared -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
145.ELIF "$(OS)" == "NETBSD"
146	@echo $(LINK) $(LINKFLAGSSHLCUI) -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
147.ELIF "$(OS)" == "MACOSX"
148	@echo $(CC) -bundle -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(EXTRA_LINKFLAGS) $(EXTRA_FRAMEWORK_FLAG) > $(MISC)$/$(@:b).cmd
149.ELSE
150	@echo $(LINK) $(LINKFLAGSSHLCUI) -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
151.ENDIF
152	cat $(MISC)$/$(@:b).cmd
153	@+source $(MISC)$/$(@:b).cmd
154.ENDIF
155
156
157$(MISC)$/$(PYUNORC) : pyuno
158	-rm -f $@
159	cat pyuno > $@
160
161$(MISC)$/pyuno.flt : pyuno.flt
162	-rm -f $@
163	cat $? > $@
164.ENDIF # L10N_framework
165
166