xref: /aoo42x/main/pyuno/zipcore/makefile.mk (revision 752c0af7)
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
57FILES=\
58	$(PYTHONBINARY)	\
59	$(foreach,i,$(FINDLIBFILES) $(DESTROOT)$/lib$(i))
60
61.IF "$(OS)" == "WNT"
62APP1TARGET = python
63APP1OBJS = $(OBJFILES) $(SOLARLIBDIR)$/pathutils-obj.obj
64APP1STDLIBS =
65APP1RPATH = BRAND
66OBJFILES = $(OBJ)$/python.obj
67.ENDIF
68
69
70.INCLUDE: target.mk
71
72ALLTAR: \
73	$(BIN)$/$(PYDIRNAME).zip
74
75.IF "$(GUI)" == "UNX"
76ALLTAR : $(BIN)$/python.sh
77$(BIN)$/python.sh : python.sh
78	-rm -f $@
79	cat $? > $@
80	sed 's/%%PYVERSION%%/$(PYVERSION)/g' < $@ > $@.new
81	mv $@.new $@
82	chmod +x $@
83.ENDIF
84
85$(OBJ)$/python.obj: $(OUT)$/inc$/pyversion.hxx
86
87$(OUT)$/inc$/pyversion.hxx: pyversion.inc
88    $(SED) $(USQ)s/@/$(PYVERSION)/g$(USQ) < $< > $@
89
90$(BIN)$/$(PYDIRNAME).zip : $(FILES)
91.IF "$(GUI)" == "UNX"
92.IF "$(OS)" != "MACOSX"
93	cd $(DESTROOT) && find . -name '*$(DLLPOST)' | xargs strip
94.ENDIF
95.ENDIF
96	-rm -f $@
97	cd $(BIN) && zip -r $(PYDIRNAME).zip $(PYDIRNAME)
98
99$(DESTROOT)$/lib$/% : $(SOLARLIBDIR)$/python$/%
100	-$(MKDIRHIER) $(@:d)
101	-rm -f $@
102	cat $< > $@
103
104.IF "$(GUI)"== "UNX"
105$(BIN)$/python$(EXECPOST).bin : $(SOLARBINDIR)$/python$(EXECPOST)
106	-$(MKDIRHIER) $(@:d)
107	-rm -f $@
108	cat $< > $@
109.IF "$(OS)" != "MACOSX"
110	strip $@
111.ENDIF
112	chmod +x $@
113.ELSE
114.IF "$(COM)" == "GCC"
115$(DESTROOT)$/bin$/python.bin : $(SOLARBINDIR)$/python$(EXECPOST)
116.ELSE
117$(DESTROOT)$/bin$/python$(EXECPOST) : $(SOLARBINDIR)$/python$(EXECPOST)
118.ENDIF
119	-$(MKDIRHIER) $(@:d)
120	-rm -f $@
121	cat $< > $@
122.ENDIF
123
124.ENDIF
125.ELSE
126ivo:
127	$(ECHO)
128.ENDIF # L10N_framework
129