Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Makefile.am
blob: 4c6f08a32a576404982348019f3f623ca366fc69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
## Process this file with automake to produce Makefile.in

if !BUILD_MINGW32
if TEXINFO
DOCS_SUBDIR=docs
else
DOCS_SUBDIR=
endif
else
DOCS_SUBDIR=
endif

SUBDIRS = po src boards $(DOCS_SUBDIR) autopackage

if OS_MACOSX
SUBDIRS += macosx
endif


icondir=$(datadir)/pixmaps
icon_DATA = gcompris.png gcompris-edit.png

if BUILD_MINGW32
Applicationsdir = $(datadir)/
Applications_in_files =
Applications_DATA =
else
Applicationsdir = $(datadir)/applications/
Applications_in_files = gcompris.desktop.in gcompris-edit.desktop.in \
	nsis_translations.desktop.in
Applications_DATA = gcompris.desktop gcompris-edit.desktop \
	nsis_translations.desktop
endif

@INTLTOOL_DESKTOP_RULE@

EXTRA_DIST = \
	$(Applications_in_files) \
	$(icon_DATA) \
	intltool-extract.in \
	intltool-merge.in \
	intltool-update.in \
	gnome2-macros/autogen.sh \
	gnome2-macros/compiler-flags.m4 \
	gnome2-macros/curses.m4 \
	gnome2-macros/gnome2-macros.dep \
	gnome2-macros/gnome-autogen.sh \
	gnome2-macros/gnome-common.m4 \
	gnome2-macros/gnome-deprecated-macros.m4 \
	README.mingw README.translators README.windows \
	config.h.mingw.in Makefile.mingw.in global_win32.mak gcompris.ico gc_admin.ico gcompris-uninstal.ico \
	gcompris-installer.nsi.in nsis_translations.desktop.in

distcore = $(PACKAGE)-core-$(VERSION)

missing_voice_error = ERROR: MISSING boards/voices.\\n \
	'      You need to get the git branch named "voices"'\\n \
	'      and make a link boards/voices that points to it'\\n

install-data-local:
	@$(NORMAL_INSTALL)
	if test -d $(srcdir)/$(PACKAGE_DATA_DIR); then \
	  $(mkinstalldirs) $(DESTDIR)/$(pkgdatadir)/$(PACKAGE_DATA_DIR); \
	  ( cd $(srcdir)/$(PACKAGE_DATA_DIR) ; \
	    tar cf -  -h --exclude "Makefile*" --exclude "*.in" --exclude "*~" --exclude ".*" --mode 644 * \
	    | ( cd $(DESTDIR)/$(pkgdatadir)/$(PACKAGE_DATA_DIR) ; \
	        tar xf - ; find -type d -exec chmod 755 '{}' \;) ; cd .. ; ) ; \
	fi
	@if test ! -d $(PACKAGE_DATA_DIR)/voices; then \
	  echo -e $(missing_voice_error); \
	fi

uninstall-local:
	-find $(DESTDIR)/$(pkgdatadir)/$(PACKAGE_DATA_DIR) -name '*' -delete

#
# We force the destruction of the $disdir under construction if
# the voices are not there.
#
dist-hook:
	@if test ! -d $(PACKAGE_DATA_DIR)/voices; then \
	  rm -fr $(distdir); \
	  echo -e $(missing_voice_error); \
	  exit 1; \
	fi
	@if test -d $(PACKAGE_DATA_DIR); then \
	  $(mkinstalldirs) $(distdir)/$(PACKAGE_DATA_DIR); \
	  ( cd $(srcdir)/$(PACKAGE_DATA_DIR) ; \
	    tar cf - -h --exclude "Makefile*" --exclude "*~" --exclude ".*" * \
	    | ( cd ../$(distdir)/$(PACKAGE_DATA_DIR) ; tar xf -) ; ); \
	fi
	@if test -d "$(srcdir)/.git"; \
	then \
		echo Creating ChangeLog && \
		( cd "$(top_srcdir)" && \
		  echo '# Generated by Makefile. Do not edit.'; echo; \
		  $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
		&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
		|| ( rm -f ChangeLog.tmp ; \
		     echo Failed to generate ChangeLog >&2 ); \
	else \
		echo A git clone is required to generate a ChangeLog >&2; \
	fi


CONFIG_CLEAN_FILES = gcompris.desktop gcompris-edit.desktop config.h.mingw \
			gcompris-installer.nsi Makefile.mingw \
			nsis_translations.desktop

clean-local:
	rm -f intltool-extract intltool-merge intltool-update
	-rm -fr $(BUNDLE_APPDIR)

update-voices:
	@if test -d $(PACKAGE_DATA_DIR)/voices; then \
	  pushd .; cd $(PACKAGE_DATA_DIR)/voices; git pull; popd; \
	else \
	  echo -e $(missing_voice_error); \
	  exit 1; \
	fi

all-local:


ACLOCAL_AMFLAGS =

if OS_MACOSX
BUNDLE_RESOURCES_DIR=$(BUNDLE_APPDIR)/Contents/Resources
BUNDLE_EXEC_DIR=$(BUNDLE_APPDIR)/Contents/MacOS
else
BUNDLE_RESOURCES_DIR=$(BUNDLE_APPDIR)/Resources
BUNDLE_EXEC_DIR=$(BUNDLE_APPDIR)
endif

if WITH_NSBUNDLE

ETC_PANGO=etc/pango
ETC_GTK=etc/gtk-2.0
GTK_CONF_FILES=gtk.immodules gdk-pixbuf.loaders im-multipress.conf
PANGO_CONF_FILES=pango.modules
FONTCONFIG_PATH=etc/fonts
GTK_MODULES_PATH=lib/gtk-2.0
PANGO_MODULES_PATH=lib/pango
EXTERN_BIN= gnuchess gnucap
PYTHON_MODULES_PATH_ORIG=lib/python$(PYTHON_VERSION)
PYTHON_MODULES_PATH_DEST=lib/python
PLIST=Info.plist
ICON=gcompris.png

FCT_CP_TAR=function cp_tar { \
	$(INSTALL) -d $$2 ; \
	(cd $$1 ; tar cf - $$3 * )| ( cd $$2; tar xf -) ; \
	}

FCT_LDD_CP=function ldd_cp { \
	for f in $$(ldd $$1 | grep $$2 | eval "sed -e 's,^.*$$2/\(.*\) (.*$$,\1,' " ); do \
           if test ! -f $$3/$$f ; then \
                echo $(INSTALL_D)  $$2/$$f $$3/$$f ; \
                $(INSTALL_D)  $$2/$$f $$3/$$f ;\
	        ldd_cp $$3/$$f  $$2 $$3;\
           fi \
        done ; }

FCT_OTOOL_CP=function otool_cp { \
	for f in $$(otool -L $$1 | grep $$2 | eval "sed -e 's,^.*$$2/\(.*.dylib\).*$$,\1,' " ); do \
            echo install_name_tool -change $$2/$$f @executable_path$$4/$$f  $$1;\
	    install_name_tool -change $$2/$$f @executable_path$$4/$$f $$1 ; \
	    if test ! -f $$3/$$f ; then \
		echo "$(INSTALL) -d $$(dirname $$3/$$f)"; \
		echo "$(INSTALL) $$2/$$f $$3/$$f "; \
		$(INSTALL) -d $$(dirname $$3/$$f); \
		$(INSTALL) $$2/$$f $$3/$$f ;\
		echo "install_name_tool -id @executable_path$$4/$$f $$3/$$f";\
		install_name_tool -id @executable_path$$4/$$f $$3/$$f;\
	        otool_cp $$3/$$f $$2 $$3 $$4 ;\
            fi \
          done; \
	}

if OS_MACOSX
INSTALL_D=function install_d { $(INSTALL) -d $$(dirname $$2); $(INSTALL) $$1 $$2 ;}; install_d
else
INSTALL_D=$(INSTALL) -D
endif

nsbundle:
	$(INSTALL) -d $(BUNDLE_RESOURCES_DIR)
	$(INSTALL) -d $(BUNDLE_EXEC_DIR)
	$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)
	make install prefix=$(BUNDLE_RESOURCES_DIR) \
		     exec_prefix=$(BUNDLE_RESOURCES_DIR) \
	             bindir=$(BUNDLE_EXEC_DIR) \
	             PYTHON_PLUGIN_DIR=$(BUNDLE_RESOURCES_DIR)/share/gcompris/python
	mv $(BUNDLE_EXEC_DIR)/gcompris $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME)
if OS_MACOSX
	$(FCT_OTOOL_CP); otool_cp $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME) $(prefix) $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR) $(NSBUNDLE_GTK_DIR)
else
	$(FCT_LDD_CP); ldd_cp $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME) $(prefix) $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)
endif
	$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_GTK)
#sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_PANGO)/pangorc > $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/pangord
	for f in $(GTK_CONF_FILES); do\
	    sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_GTK)/$$f > $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_GTK)/$$f ;\
        done
	$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)
	for f in $(PANGO_CONF_FILES); do\
	    sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_PANGO)/$$f > $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/$$f ;\
        done
	$(INSTALL) $(top_srcdir)/macosx/pangorc $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/pangorc
	$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH)
	$(FCT_CP_TAR); cp_tar $(prefix)/$(FONTCONFIG_PATH) $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH)
	$(INSTALL) macosx/fonts.conf $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH)
	$(FCT_CP_TAR); cp_tar $(prefix)/$(GTK_MODULES_PATH)  $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(GTK_MODULES_PATH) "--exclude include"
	$(FCT_CP_TAR); cp_tar $(prefix)/$(PANGO_MODULES_PATH) $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(PANGO_MODULES_PATH)
	$(FCT_CP_TAR); cp_tar $(prefix)/$(PYTHON_MODULES_PATH_ORIG) $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(PYTHON_MODULES_PATH_DEST)
	for f in $(EXTERN_BIN); do \
	   $(INSTALL_D)  $(prefix)/bin/$$f $(BUNDLE_RESOURCES_DIR)/bin/$$f; \
	done
if OS_MACOSX
	$(INSTALL) $(top_srcdir)/macosx/Info.plist $(BUNDLE_RESOURCES_DIR)/../
	$(INSTALL) $(top_srcdir)/macosx/PkgInfo $(BUNDLE_RESOURCES_DIR)/../
	$(INSTALL) $(top_srcdir)/macosx/GCompris.icns $(BUNDLE_RESOURCES_DIR)/
	$(FCT_OTOOL_CP) ; for s in $$(find  $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/ -name '*.so') ; do \
		otool_cp $$s $(prefix) $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR) $(NSBUNDLE_GTK_DIR) ; \
	done
	$(FCT_OTOOL_CP) ; for s in $$(find  $(BUNDLE_RESOURCES_DIR) -name '*.so') ; do \
		otool_cp $$s $(prefix) $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR) $(NSBUNDLE_GTK_DIR) ; \
	done
	echo WARNING ! I suppose SDL Framewroks installed in /Library/Frameworks
	$(FCT_CP_TAR); cp_tar /Library/Frameworks/SDL.framework $(BUNDLE_EXEC_DIR)/../Frameworks/SDL.framework
	$(FCT_CP_TAR); cp_tar /Library/Frameworks/SDL_mixer.framework $(BUNDLE_EXEC_DIR)/../Frameworks/SDL_mixer.framework
else
	$(INSTALL) $(top_srcdir)/macosx/gcompris.png $(BUNDLE_RESOURCES_DIR)/
	$(INSTALL) $(top_srcdir)/macosx/Info-gnustep.plist $(BUNDLE_RESOURCES_DIR)/
endif

endif

DISTCLEANFILES = intltool-extract \
	intltool-merge \
	intltool-update \
	po/.intltool-merge-cache