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