xref: /aoo42x/main/pyuno/zipcore/makefile.mk (revision 0a45483e)
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
23
24PRJNAME=pyuno
25PRJ=..
26
27TARGET=zipcore
28LIBTARGET=NO
29
30.INCLUDE : settings.mk
31.IF "$(L10N_framework)"==""
32UWINAPILIB =
33
34.IF "$(SYSTEM_PYTHON)" == "YES" || "$(GUI)" == "OS2"
35systempython:
36        @echo "Not building python-core because system python is being used"
37.ELSE
38
39.INCLUDE : pyversion.mk
40
41PYDIRNAME=python-core-$(PYVERSION)
42DESTROOT=$(BIN)$/$(PYDIRNAME)
43.IF "$(GUI)" == "UNX"
44PYTHONBINARY=$(BIN)$/python$(EXECPOST).bin
45.ELSE
46.IF "$(COM)" == "GCC"
47PYTHONBINARY=$(DESTROOT)$/bin$/python.bin
48.ELSE
49PYTHONBINARY=$(DESTROOT)$/bin$/python$(EXECPOST)
50.ENDIF
51.ENDIF
52
53FINDLIBFILES_TMP:=$(subst,/,$/ \
54	$(shell @$(FIND) $(SOLARLIBDIR)$/python -type f| $(GREP) -v "\.pyc" |$(GREP) -v "\.py~" |$(GREP) -v .orig | $(GREP) -v _failed))
55FINDLIBFILES=$(subst,$(SOLARLIBDIR)$/python, $(FINDLIBFILES_TMP))
56
57FINDINCFILES_TMP:=$(subst,/,$/ \
58	$(shell @$(FIND) $(SOLARINCDIR)$/python -type f| $(GREP) -v "\.h~" | $(GREP) -v _failed))
59FINDINCFILES=$(subst,$(SOLARINCDIR)$/python, $(FINDINCFILES_TMP))
60
61FILES=\
62	$(PYTHONBINARY)	\
63	$(foreach,i,$(FINDLIBFILES) $(DESTROOT)$/lib$(i)) \
64	$(foreach,i,$(FINDINCFILES) $(DESTROOT)$/include$/python$(PYMAJOR).$(PYMINOR)$(i))
65
66.IF "$(OS)" == "WNT"
67APP1TARGET = python
68APP1OBJS = $(OBJFILES) $(SOLARLIBDIR)$/pathutils-obj.obj
69APP1STDLIBS =
70APP1RPATH = BRAND
71OBJFILES = $(OBJ)$/python.obj
72.ENDIF
73
74
75.INCLUDE: target.mk
76
77ALLTAR: \
78	$(BIN)$/$(PYDIRNAME).zip
79
80.IF "$(GUI)" == "UNX"
81ALLTAR : $(BIN)$/python.sh
82$(BIN)$/python.sh : python.sh
83	-rm -f $@
84	cat $? > $@
85	sed 's/%%PYVERSION%%/$(PYVERSION)/g' < $@ > $@.new
86	mv $@.new $@
87	chmod +x $@
88.ENDIF
89
90$(OBJ)$/python.obj: $(OUT)$/inc$/pyversion.hxx
91
92$(OUT)$/inc$/pyversion.hxx: pyversion.inc
93    $(SED) $(USQ)s/@/$(PYVERSION)/g$(USQ) < $< > $@
94
95$(BIN)$/$(PYDIRNAME).zip : $(FILES)
96.IF "$(GUI)" == "UNX"
97.IF "$(OS)" != "MACOSX"
98	cd $(DESTROOT) && find . -name '*$(DLLPOST)' | xargs strip
99.ENDIF
100.ENDIF
101	-rm -f $@
102	cd $(BIN) && zip -r $(PYDIRNAME).zip $(PYDIRNAME)
103
104$(DESTROOT)$/lib$/% : $(SOLARLIBDIR)$/python$/%
105	-$(MKDIRHIER) $(@:d)
106	-rm -f $@
107	cat $< > $@
108
109$(DESTROOT)$/include$/python$(PYMAJOR).$(PYMINOR)%: $(SOLARINCDIR)$/python$/%
110	-$(MKDIRHIER) $(@:d)
111	-rm -f $@
112	cat $< > $@
113
114.IF "$(GUI)"== "UNX"
115$(BIN)$/python$(EXECPOST).bin : $(SOLARBINDIR)$/python$(EXECPOST)
116	-$(MKDIRHIER) $(@:d)
117	-rm -f $@
118	cat $< > $@
119.IF "$(OS)" != "MACOSX"
120	strip $@
121.ENDIF
122	chmod +x $@
123.ELSE
124.IF "$(COM)" == "GCC"
125$(DESTROOT)$/bin$/python.bin : $(SOLARBINDIR)$/python$(EXECPOST)
126.ELSE
127$(DESTROOT)$/bin$/python$(EXECPOST) : $(SOLARBINDIR)$/python$(EXECPOST)
128.ENDIF
129	-$(MKDIRHIER) $(@:d)
130	-rm -f $@
131	cat $< > $@
132.ENDIF
133
134.ENDIF
135.ELSE
136ivo:
137	$(ECHO)
138.ENDIF # L10N_framework
139