* implemented the generic VLC media player Help window on OSX to match the QT4 interf...
[vlc.git] / extras / MacOSX / Framework / Makefile
1 CC=gcc
2 CFLAGS=-g -O2
3 OBJCFLAGS=-fobjc-exceptions 
4 LDFLAGS=-single_module -read_only_relocs suppress
5
6 # We should set this properly.
7 top_srcdir=../../..
8 top_builddir=../../..
9
10 LIBVLC_HEADERS=$(top_srcdir)/include
11 VLCCONFIG=$(top_srcdir)/vlc-config
12
13 MODULES = $(patsubst %,$(SRC_DIR)/%,$(_MODULES))
14
15 HEADERS_DIR = Headers
16
17 _EXPORTED_HEADERS= \
18      VLC/VLC.h \
19      VLC/VLCMedia.h \
20      VLC/VLCMediaDiscoverer.h \
21      VLC/VLCMediaLibrary.h \
22      VLC/VLCPlaylist.h \
23      VLC/VLCPlaylistDataSource.h \
24      VLC/VLCServicesDiscoverer.h \
25      VLC/VLCTime.h \
26      VLC/VLCVideoView.h
27
28 EXPORTED_HEADERS = $(patsubst %,$(HEADERS_DIR)/%,$(_EXPORTED_HEADERS))
29
30 EXPORTED_RESOURCES= \
31      Resources/Info.plist \
32      Resources/version.plist
33
34 SRC_DIR = Sources
35
36 _SRC = \
37      test.m \
38      VLCEventManager.m \
39      VLCLibrary.m \
40          VLCMedia.m \
41          VLCMediaLibrary.m \
42      VLCMediaDiscoverer.m \
43          VLCPlaylist.m \
44      VLCPlaylistDataSource.m \
45      VLCServicesDiscoverer.m \
46      VLCTime.m \
47      VLCVideoView.m
48
49 SRC = $(patsubst %,$(SRC_DIR)/%,$(_SRC))
50
51 HEADERS = $(EXPORTED_HEADERS)
52
53 INCLUDES=  -I .  -I $(LIBVLC_HEADERS) -I $(HEADERS_DIR) -I $(HEADERS_DIR)/Internal
54
55 FRAMEWORKS= -framework Cocoa  
56
57 OBJECTS=$(SRC:.m=.o)
58
59 all: VLC.framework
60
61 $(OBJECTS): $(HEADERS)
62
63 .m.o: $<
64         $(CC) -c $(CFLAGS) $(OBJCFLAGS) $(INCLUDES) $< -o $@
65
66 DIR = VLC.framework \
67       VLC.framework/Version/Current/Framework \
68       VLC.framework/Version/Current/Headers \
69
70 VLC.framework/lib/libvlc.dylib: $(top_builddir)/src/.libs/libvlc.dylib VLC.framework/lib
71         cp -f $(top_builddir)/src/.libs/libvlc.1.dylib VLC.framework/lib/libvlc.dylib && \
72         install_name_tool -id `pwd`/VLC.framework/lib/libvlc.1.dylib \
73                            VLC.framework/lib/libvlc.dylib
74         install_name_tool -change @executable_path/lib/vlc_libintl.dylib \
75                                   `pwd`/VLC.framework/lib/vlc_libintl.dylib  $@
76
77 VLC.framework/lib/libvlc-control.dylib: $(top_builddir)/src/.libs/libvlc-control.dylib VLC.framework/lib
78         mkdir -p VLC.framework/Version/Current/lib && \
79         cp -f $< $@ && \
80         install_name_tool -id `pwd`/$@ $@ && \
81         install_name_tool -change /usr/local/lib/libvlc.1.dylib \
82                                   `pwd`/VLC.framework/lib/libvlc.dylib  $@
83         install_name_tool -change @executable_path/lib/vlc_libintl.dylib \
84                                   `pwd`/VLC.framework/lib/vlc_libintl.dylib  $@
85
86
87 VLC.framework/Headers: $(HEADERS)
88         mkdir -p VLC.framework/Version/Current/Headers && \
89         cp -f $(EXPORTED_HEADERS) VLC.framework/Version/Current/Headers && \
90         ln -sf Version/Current/Headers VLC.framework
91
92 VLC.framework/Resources:
93         mkdir -p VLC.framework/Version/Current/Resources && \
94         cp -f $(EXPORTED_RESOURCES) VLC.framework/Version/Current/Resources && \
95         ln -sf Version/Current/Resources VLC.framework
96
97
98 VLC.framework/modules:
99         /usr/bin/install -c -d ./VLC.framework/Version/Current/modules && \
100         for i in `top_builddir="$(top_builddir)" $(VLCCONFIG) --target plugin` ; do \
101           if test -n "$$i" ; \
102         then \
103             cp "`pwd`/`dirname $$i`/.libs/`basename $$i`.dylib" \
104                "./VLC.framework/Version/Current/modules" ; \
105                 module="./VLC.framework/Version/Current/modules/`basename $$i`.dylib"; \
106             install_name_tool -change /usr/local/lib/libvlc.1.dylib \
107                                   @loader_path/../lib/libvlc.dylib \
108                           "$$module"; \
109             echo "changing install name of $$module";\
110             for lib in `otool -L "$$module" | grep @executable_path | sed 's/(\([0-z]*\ *\.*\,*\)*)//g'` ; do \
111                 install_name_tool -change "$$lib" \
112                                        `echo "$$lib" | sed 's:executable_path:loader_path/../:'` \
113                               "$$module"; \
114             done; \
115           fi \
116     done && \
117         ln -sf Version/Current/modules VLC.framework
118         
119
120 VLC.framework/share:
121         cp -R $(top_builddir)/share ./VLC.framework/Version/Current && \
122         ln -sf Version/Current/share ./VLC.framework
123
124 VLC.framework/lib: 
125         mkdir -p VLC.framework/Version/Current/lib && \
126         if test -d $(top_builddir)/extras/contrib/vlc-lib; then \
127           for i in $(top_builddir)/extras/contrib/vlc-lib/*.dylib ; do \
128                 module="VLC.framework/Version/Current/lib/`basename $${i}`"; \
129             cp `pwd`/$${i}  $${module} ; \
130                 install_name_tool -change /usr/local/lib/libvlc.1 @loader_path/../lib/libvlc.dylib \
131                                   $${module}; \
132             echo "changing install name of $$module";\
133             for lib in `otool -L "$$module" | grep @executable_path | sed 's/(\([0-z]*\ *\.*\,*\)*)//g'` ; do \
134                 install_name_tool -change "$$lib" \
135                                        `echo "$$lib" | sed 's:executable_path:loader_path/../:'` \
136                               "$$module"; \
137             done; \
138           done \
139     fi && \
140         ln -sf Version/Current/lib VLC.framework
141     
142 VLC.framework/VLC:
143         ln -sf Version/Current/VLC VLC.framework
144
145 VLC.framework/Version/Current/VLC: $(OBJECTS) VLC.framework/Headers VLC.framework/Resources VLC.framework/lib/libvlc-control.dylib VLC.framework/lib/libvlc.dylib VLC.framework/modules VLC.framework/share VLC.framework/VLC
146         mkdir -p VLC.framework/Version/Current/Framework && \
147         $(CXX) -dynamiclib $(LDFLAGS) $(OBJECTS) $(FRAMEWORKS) -LVLC.framework/lib -lvlc -lvlc-control $(MODULES) $(LIBS) -install_name @loader_path/../Frameworks/VLC.framework/Version/Current/VLC -o VLC.framework/Version/Current/VLC && \
148         install_name_tool -change `pwd`/VLC.framework/lib/libvlc-control.0.dylib \
149                                   `pwd`/VLC.framework/lib/libvlc-control.dylib \
150                            VLC.framework/Version/Current/VLC && \
151         install_name_tool -change `pwd`/VLC.framework/lib/libvlc.1.dylib \
152                                   `pwd`/VLC.framework/lib/libvlc.dylib \
153                            VLC.framework/Version/Current/VLC && \
154         touch VLC.framework
155
156 VLC.framework:: VLC.framework/Version/Current/VLC
157  
158 .PHONY: clean
159
160 clean:
161         rm -Rf VLC.framework
162         rm -Rf $(OBJECTS) *.o $(SRC_DIR)/*.o