xref: /trunk/main/pyuno/source/module/makefile.mk (revision 7871dc3e)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23PRJ=..$/..
24
25PRJNAME=pyuno
26TARGET=pyuno
27ENABLE_EXCEPTIONS=TRUE
28
29LINKFLAGSDEFS = # do not fail with missing symbols
30
31# --- Settings -----------------------------------------------------
32
33.INCLUDE :  settings.mk
34.IF "$(L10N_framework)"==""
35#-------------------------------------------------------------------
36
37.IF "$(OS)$(COMEX)" == "SOLARIS4"
38# no -Bdirect for SunWS CC
39DIRECT = $(LINKFLAGSDEFS)
40.ENDIF
41
42# special setting from environment
43.IF "$(EXTRA_CFLAGS)"!=""
44EXTRA_FRAMEWORK_FLAG=-framework Python
45.ENDIF # .IF "$(EXTRA_CFLAGS)"!=""
46
47.IF "$(GUI)" == "UNX"
48# python expects modules without the lib prefix
49# pyuno.so even on Mac OS X, because it is a python module
50PYUNO_MODULE=$(DLLDEST)$/pyuno.so
51PYUNORC=pyunorc
52.ELIF "$(GUI)" == "OS2"
53#.INCLUDE :  pyversion.mk
54PYUNORC=pyuno.ini
55.ELSE
56.INCLUDE :  pyversion.mk
57PYUNORC=pyuno.ini
58DLLPOST=.pyd
59.ENDIF
60
61.IF "$(SYSTEM_PYTHON)" == "YES"
62PYTHONLIB=$(PYTHON_LIBS)
63CFLAGS+=$(PYTHON_CFLAGS)
64.ELSE # "$(SYSTEM_PYTHON)" == "YES"
65.INCLUDE :  pyversion.mk
66CFLAGS+=-I$(SOLARINCDIR)$/python
67.ENDIF # "$(SYSTEM_PYTHON)" == "YES"
68
69SHL1TARGET=$(TARGET)
70SLOFILES= \
71		$(SLO)$/pyuno_runtime.obj 	\
72		$(SLO)$/pyuno.obj 		\
73		$(SLO)$/pyuno_callable.obj 	\
74		$(SLO)$/pyuno_module.obj 	\
75		$(SLO)$/pyuno_type.obj 		\
76		$(SLO)$/pyuno_util.obj		\
77		$(SLO)$/pyuno_except.obj	\
78		$(SLO)$/pyuno_adapter.obj	\
79		$(SLO)$/pyuno_gc.obj
80
81# remove this, when issue i35064 is integrated
82.IF "$(COM)"=="GCC"
83NOOPTFILES= \
84	$(SLO)$/pyuno_module.obj
85.ENDIF			# "$(COM)"=="GCC"
86
87
88SHL1STDLIBS= \
89		$(CPPULIB)		\
90		$(CPPUHELPERLIB)	\
91		$(SALLIB)		\
92		$(PYTHONLIB) 		\
93		$(EXTRA_FRAMEWORK_FLAG)
94
95SHL1DEPN=
96SHL1LIBS=$(SLB)$/$(TARGET).lib
97SHL1IMPLIB=i$(TARGET)
98
99SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
100
101DEF1NAME=	$(SHL1TARGET)
102DEF1DEPN=	$(MISC)$/pyuno.flt
103
104DEFLIB1NAME=$(TARGET)
105
106# --- Targets ------------------------------------------------------
107
108.IF "$(GUI)$(COM)"=="WNTGCC"
109ALLTAR : \
110	$(DLLDEST)$/uno.py 		\
111	$(DLLDEST)$/unohelper.py	\
112	$(PYUNO_MODULE)			\
113	$(MISC)$/$(PYUNORC)		\
114	$(LB)$/lib$(TARGET).a
115
116$(LB)$/lib$(TARGET).a: $(MISC)$/$(TARGET).def
117	dlltool --dllname $(TARGET)$(DLLPOST) --input-def=$(MISC)$/$(TARGET).def --kill-at --output-lib=$(LB)$/lib$(TARGET).a
118.ELSE
119ALLTAR : \
120	$(DLLDEST)$/uno.py 		\
121	$(DLLDEST)$/unohelper.py	\
122	$(PYUNO_MODULE)			\
123	$(MISC)$/$(PYUNORC)
124.ENDIF
125.ENDIF
126
127.INCLUDE :  target.mk
128.IF "$(L10N_framework)"==""
129$(DLLDEST)$/%.py: %.py
130	cp $? $@
131
132
133.IF "$(GUI)" == "UNX"
134$(PYUNO_MODULE) : $(SLO)$/pyuno_dlopenwrapper.obj
135.IF "$(OS)" == "LINUX"
136	@echo $(LINK) $(LINKFLAGS) $(LINKFLAGSRUNPATH_OOO) $(LINKFLAGSSHLCUI) -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
137.ELIF "$(OS)" == "SOLARIS"
138	@echo ld -G -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
139.ELIF "$(OS)" == "FREEBSD"
140	@echo ld -shared -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
141.ELIF "$(OS)" == "NETBSD"
142	@echo $(LINK) $(LINKFLAGSSHLCUI) -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
143.ELIF "$(OS)" == "MACOSX"
144	@echo $(CC) -bundle -ldl -o $@ $(SLO)$/pyuno_dlopenwrapper.o $(EXTRA_LINKFLAGS) $(EXTRA_FRAMEWORK_FLAG) > $(MISC)$/$(@:b).cmd
145.ELSE
146	@echo $(LINK) $(LINKFLAGSSHLCUI) -o $@ $(SLO)$/pyuno_dlopenwrapper.o > $(MISC)$/$(@:b).cmd
147.ENDIF
148	cat $(MISC)$/$(@:b).cmd
149	@+source $(MISC)$/$(@:b).cmd
150.ENDIF
151
152
153$(MISC)$/$(PYUNORC) : pyuno
154	-rm -f $@
155	cat pyuno > $@
156
157$(MISC)$/pyuno.flt : pyuno.flt
158	-rm -f $@
159	cat $? > $@
160.ENDIF # L10N_framework
161
162