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
24PRJ=../../..
25PRJNAME=extensions
26TARGET=spotlightplugin
27
28# --- Settings ----------------------------------
29.INCLUDE : settings.mk
30
31.IF "$(OS)"!="MACOSX"
32dummy:
33    @echo Not using Mac OS X - nothing to build
34.ENDIF
35
36# --- Files -------------------------------------
37
38# ... object files ............................
39SLOFILES= \
40        $(SLO)$/ioapi.obj                \
41        $(SLO)$/unzip.obj                \
42        $(SLO)$/main.obj                 \
43        $(SLO)$/GetMetadataForFile.obj   \
44        $(SLO)$/OOoContentDataParser.obj \
45        $(SLO)$/OOoMetaDataParser.obj    \
46        $(SLO)$/OOoSpotlightImporter.obj \
47
48BUNDLE =    $(MISC)$/OOoSpotlightImporter.mdimporter
49CONTENTS =  $(BUNDLE)$/Contents
50RESOURCES = $(CONTENTS)$/Resources
51MACOS =     $(CONTENTS)$/MacOS
52
53BUNDLELIBS= -framework CoreFoundation \
54            -framework Foundation     \
55            -framework CoreServices   \
56            $(ZLIB3RDLIB)
57
58plistfiles  = $(CONTENTS)$/Info.plist
59binaries =    $(MACOS)$/OOoSpotlightImporter
60resources =   $(RESOURCES)/en.lproj/schema.strings \
61              $(RESOURCES)/schema.xml
62
63ZIPFLAGS = -r
64ZIP1TARGET = mdibundle
65ZIP1DIR = $(CONTENTS)
66ZIP1LIST = *
67
68
69# --- Targets ----------------------------------
70
71.INCLUDE : target.mk
72
73.IF "$(ZIP1TARGETN)"!=""
74$(ZIP1TARGETN) : $(plistfiles) $(binaries) $(resources)
75
76.ENDIF          # "$(ZIP1TARGETN)"!=""
77
78# Info.plist is just versioned and copied into the bundle
79$(CONTENTS)$/%.plist : mdimporter/%.plist
80    $(MKDIRHIER) $(@:d)
81    $(COPY) "$<" "$@"
82
83$(MACOS)$/OOoSpotlightImporter: $(SLOFILES)
84    $(MKDIRHIER) $(@:d)
85    $(CC) -o $(MACOS)$/OOoSpotlightImporter $(SLOFILES:s/.obj/.o/) $(EXTRA_LINKFLAGS) $(BUNDLELIBS) -bundle
86# we have to change the zlib install name, otherwise the plugin will not work
87    .IF "$(SYSTEM_ZLIB)"=="NO"
88    install_name_tool -change @executable_path/libz.1.dylib @executable_path/../../../../MacOS/libz.1.dylib $(MACOS)$/OOoSpotlightImporter
89    .ENDIF
90
91#the resources are just copied
92$(RESOURCES)$/% : mdimporter/%
93    $(MKDIRHIER) $(@:d)
94    $(COPY) "$<" "$@"
95
96